Hello Codeforces! I've been struggling with this problem for half an hour, I've been testing it but I couldn't find the wrong one. Can you help me? UPD: I solved the problem,Thanks. Reason: I couldn't get all the positive numbers.
| # | User | Rating |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | jiangly | 3670 |
| 3 | Kevin114514 | 3657 |
| 4 | maroonrk | 3355 |
| 5 | Um_nik | 3353 |
| 6 | squareOf105 | 3346 |
| 7 | tourist | 3343 |
| 8 | strapple | 3324 |
| 9 | heuristica | 3322 |
| 10 | jiangbowen | 3291 |
| # | User | Contrib. |
|---|---|---|
| 1 | Qingyu | 158 |
| 2 | nik_exists | 150 |
| 2 | maspy | 150 |
| 4 | AmShZ | 143 |
| 5 | Um_nik | 141 |
| 6 | Errichto | 139 |
| 7 | adamant | 137 |
| 8 | BledDest | 133 |
| 8 | maroonrk | 133 |
| 10 | qwexd | 130 |
Hello Codeforces! I've been struggling with this problem for half an hour, I've been testing it but I couldn't find the wrong one. Can you help me? UPD: I solved the problem,Thanks. Reason: I couldn't get all the positive numbers.
| Name |
|---|



Though I really can't understand what you are trying to do but may be you are thinking too much.
if its a bonus card store it somewhere.
if its a hero card pick the max bonus card and give it to hero and discard that card.
The main vision of the problem is make sure you know how to pick max element of a deck(List) in most suitable time complexity. Just think of a data structure that does the job.
Your code gives the wrong answer for the following test case:
Instead of doing what you're doing, it'd be simpler to simply maintain a priority queue / multiset of all elements and remove the largest one everytime you encounter a hero. Like this.