Блог пользователя S.P.A.R.K

Автор S.P.A.R.K, история, 2 года назад, По-английски

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

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

»
2 года назад, # |
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:

10

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.