satyam343's blog

By satyam343, 19 months ago, In English

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!

  • Vote: I like it
  • +61
  • Vote: I do not like it

»
19 months ago, # |
  Vote: I like it +8 Vote: I do not like it

Reminder: Contest starts in 1.5 hours!

»
19 months ago, # |
  Vote: I like it -20 Vote: I do not like it

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

  • »
    »
    19 months ago, # ^ |
      Vote: I like it +27 Vote: I do not like it

    Problems won't and shouldn't be discussed in public during the contest. You can use the comments section for clarifications.

  • »
    »
    19 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Because n cannot be greater than m.

»
19 months ago, # |
Rev. 2   Vote: I like it +27 Vote: I do not like it

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

  • »
    »
    19 months ago, # ^ |
      Vote: I like it +30 Vote: I do not like it

    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.

»
19 months ago, # |
Rev. 3   Vote: I like it 0 Vote: I do not like it

Can anyone please tell me how to solve this problem?

Minimum Ugliness

  • »
    »
    19 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

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

    • »
      »
      »
      19 months ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      how to do that efficiently?

      • »
        »
        »
        »
        19 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

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

        • »
          »
          »
          »
          »
          19 months ago, # ^ |
            Vote: I like it +3 Vote: I do not like it

          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

      • »
        »
        »
        »
        19 months ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        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.

»
19 months ago, # |
Rev. 2   Vote: I like it +16 Vote: I do not like it

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.

»
19 months ago, # |
Rev. 4   Vote: I like it 0 Vote: I do not like it

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!