When I uncomment 3rd line i.e when I convert all integer to long long. Why am I getting runtime error on test case 8. Without this conversion i.e. int to long long code is getting accepted.
# | User | Rating |
---|---|---|
1 | jiangly | 3977 |
2 | tourist | 3815 |
3 | jqdai0815 | 3682 |
4 | ksun48 | 3614 |
5 | orzdevinwang | 3526 |
6 | ecnerwala | 3514 |
7 | Benq | 3483 |
8 | hos.lyric | 3381 |
9 | gamegame | 3374 |
10 | heuristica | 3358 |
# | User | Contrib. |
---|---|---|
1 | cry | 170 |
2 | -is-this-fft- | 162 |
2 | Um_nik | 162 |
4 | atcoder_official | 160 |
5 | djm03178 | 157 |
6 | Dominater069 | 156 |
7 | adamant | 154 |
8 | luogu_official | 152 |
8 | awoo | 152 |
10 | TheScrasse | 147 |
When I uncomment 3rd line i.e when I convert all integer to long long. Why am I getting runtime error on test case 8. Without this conversion i.e. int to long long code is getting accepted.
Name |
---|
Try initializing arr, down and up globally. It's generally not good to initialize arrays inside functions because of potential memory overflow
I faced similar issue and the reason is because of memory allocation in cpp. The arrays inside main are allocated on stack which has a fixed size of 256mb and when it exceeds that, it throws a runtime error. I didn't convert long long to int but instead used vectors (allocated on heap) and got ac
Thanks man really appreciated!!