I am trying to solve 1287C - Гирлянда I wrote 70338791 It's working fine on my machine but showing runtime error on codeforces. Can someone explain me why this is happening.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
3 | maomao90 | 162 |
3 | atcoder_official | 162 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | Dominater069 | 153 |
9 | nor | 153 |
I am trying to solve 1287C - Гирлянда I wrote 70338791 It's working fine on my machine but showing runtime error on codeforces. Can someone explain me why this is happening.
Название |
---|
I didnt read your code completely, but in the first line of your solve() function, you mentioned _odd and _even can contain the value -1 . so it may happen something like this, dp[idx][-1][1][last] ..
But why is it working in my machine.
The following update fixed your solution.
70350376
The exit code in the run-time error is a segmentation fault that is raised when one of the indices of the dp array is out-of-range. Your soluton obviously processed the memory locations outside the valid memory space allocated to the dp array in your machine without raising a segmentation fault. This may happen in some machines, but the fault may be detected when running the code in another place.
or see this and fix that code (always debug by yourself please)
next time use codeforces CUSTOM INVOCATION to check your RTE code not on your computer
Thanks A lot .Got my mistake :) .