Блог пользователя satyam343

Автор satyam343, 12 месяцев назад, По-английски

We invite you to participate in CodeChef’s Starters 90, this Wednesday, 17th May, rated till 6-stars Coders (ie. for users with rating < 2500).

Time: 8:00 PM — 10:00 PM IST

Note that the duration is 2 hours. Read about the recent CodeChef changes here.

Joining us on the problem setting panel are:

Written editorials will be available for all on discuss.codechef.com. Pro users can find the editorials directly on the problem pages after the contest.

The video editorials of the problems will be available for all users for 1 day as soon as the contest ends, after which they will be available only to Pro users.

Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef's contests, you can share them here.

Hope to see you participating. Good Luck!

  • Проголосовать: нравится
  • +61
  • Проголосовать: не нравится

»
12 месяцев назад, # |
  Проголосовать: нравится +8 Проголосовать: не нравится

Reminder: Contest starts in 1.5 hours!

»
12 месяцев назад, # |
  Проголосовать: нравится -20 Проголосовать: не нравится

In Crushed Apples and a Balance Scale why is answer for "4 9" NO ?

»
12 месяцев назад, # |
Rev. 2   Проголосовать: нравится +27 Проголосовать: не нравится

no hate to the authors, but problem CHEFPARTY is exactly the same as Jzzhu and Apples

  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится +30 Проголосовать: не нравится

    We(me and the author) were not aware of this problem.

    I think the problem idea is quite natural, and one can come up with such an idea independently.

    I hope you enjoyed the remaining problems.

»
12 месяцев назад, # |
Rev. 3   Проголосовать: нравится 0 Проголосовать: не нравится

Can anyone please tell me how to solve this problem?

Minimum Ugliness

  • »
    »
    12 месяцев назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    you have to find the diameter considering endpoint between k given vertex.. then ans= (diam+1)/2

    • »
      »
      »
      12 месяцев назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      how to do that efficiently?

      • »
        »
        »
        »
        12 месяцев назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        You can use the concept of Virtual Tree to process each query in O(k) time.

        • »
          »
          »
          »
          »
          12 месяцев назад, # ^ |
            Проголосовать: нравится +3 Проголосовать: не нравится

          you can solve it without using a virtual tree as one endpoint will always be the node with maximum depth and the other endpoint can be found by calculating the distance from the first endpoint

      • »
        »
        »
        »
        12 месяцев назад, # ^ |
          Проголосовать: нравится 0 Проголосовать: не нравится

        Link

        Here, I firstly iterate every k vertex and find the max depth vertex. Then iterate again every k-vertex and find the maximum distance from that previous vertex If you see that more deeply, it is same as diameter find idea of a tree.

»
12 месяцев назад, # |
Rev. 2   Проголосовать: нравится +16 Проголосовать: не нравится

In the short contest, you should give every problem a weight like CF. If it is a long contest then its ok. Also, you can take a servery and choose, that most people want. Weighted problem can save your rating, when you can not solve a easy problem.

»
12 месяцев назад, # |
Rev. 4   Проголосовать: нравится 0 Проголосовать: не нравится

Can someone tell me why my code for Sum of Goodness gives RTE on one test case or provide me with a test case where it fails? It would be a great help.

Code

Thanks!

EDIT- It worked when I removed my template and submitted the Code. Can someone tell me why it was failing? Is it the fault of the compiler?

EDIT 2- I found the piece of code which gave an error, but I don't know why. Can someone please explain me?

Reason- I took the input like this ( cin>>v (vector), and when I changed this to for(auto &i:v) cin>>i), it passed. Why? What was the error in that?

Edit 3- It was probably the coordinators' fault they created a case with n=0(constraints was n>=1), which led to runtime error.

Just wow!