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
# | User | Rating |
---|---|---|
1 | tourist | 3985 |
2 | orzdevinwang | 3844 |
3 | jqdai0815 | 3682 |
4 | jiangly | 3618 |
5 | Benq | 3529 |
6 | ksun48 | 3489 |
7 | Radewoosh | 3483 |
8 | Kevin114514 | 3443 |
9 | ecnerwala | 3392 |
9 | Um_nik | 3392 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
2 | atcoder_official | 163 |
4 | maomao90 | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 155 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
10 | djm03178 | 152 |
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
Name |
---|
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.
Thank u so much bro.