Hi, Can anyone explain why does i get Runtime Error ?! Problem : http://codeforces.me/contest/975/problem/C Submission Code : http://codeforces.me/contest/975/submission/37910273 Thanks
Hi, Can anyone explain why does i get Runtime Error ?! Problem : http://codeforces.me/contest/975/problem/C Submission Code : http://codeforces.me/contest/975/submission/37910273 Thanks
| № | Пользователь | Рейтинг |
|---|---|---|
| 1 | Benq | 3676 |
| 2 | Kevin114514 | 3659 |
| 3 | jiangly | 3640 |
| 4 | turmax | 3450 |
| 5 | tourist | 3408 |
| 6 | strapple | 3360 |
| 7 | Um_nik | 3354 |
| 8 | squareOf105 | 3348 |
| 9 | maroonrk | 3312 |
| 10 | idontwannadothis…e | 3191 |
| Страны | Города | Организации | Всё → |
| № | Пользователь | Вклад |
|---|---|---|
| 1 | Qingyu | 154 |
| 2 | nik_exists | 151 |
| 3 | maspy | 149 |
| 4 | AmShZ | 146 |
| 5 | Um_nik | 143 |
| 6 | Errichto | 139 |
| 7 | BledDest | 136 |
| 8 | adamant | 135 |
| 9 | maroonrk | 133 |
| 10 | cry | 130 |
| Название |
|---|



Next time, spend some time to write code to generate random tests. It is not difficult to do that, especially in python.
I've got no time to read your code. But I've modified the input portion to accept randomly generated tests rather than read from stdin.
I found that the following test case causes a runtime error in your code.
12 11
1 8 3 12 6 1 7 4 12 6 6 14
6 11 11 8 9 3 8 9 7 9 12
Note that this might not be the only test that causes a runtime error.
Here is the modified version of your code that reads randomly generated inputs: