3

Silly to ask, but reallly irritating

 2 years ago
source link: http://codeforces.com/blog/entry/101742
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Silly to ask, but reallly irritating

My solution to the problem 1665C - Tree Infection : 153109990 gives WA on test6 and i am unable to find the corner case . If possible, please help correcting my solution

19 hours ago, # |

Rev. 2  

+32

In general, your solution fails whenever there are multiple highest elements where element-bs-1==0 inside the priority queue. while that particular top element is finished, the other top elements are not and still have a value of 1. (eg. multiple 2s, bs=1) Here's a counterexample demonstrating this:

1 1 1 1 2 2 2 2 2

(Answer should be 5)

If you remove the line that handles this, your solution should work.


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK