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 | 3898 |
2 | tourist | 3840 |
3 | orzdevinwang | 3706 |
4 | ksun48 | 3691 |
5 | jqdai0815 | 3682 |
6 | ecnerwala | 3525 |
7 | gamegame | 3477 |
8 | Benq | 3468 |
9 | Ormlis | 3381 |
10 | maroonrk | 3379 |
# | User | Contrib. |
---|---|---|
1 | cry | 168 |
2 | -is-this-fft- | 165 |
3 | Dominater069 | 161 |
4 | Um_nik | 160 |
5 | atcoder_official | 159 |
6 | djm03178 | 157 |
7 | adamant | 153 |
8 | luogu_official | 151 |
9 | awoo | 149 |
10 | TheScrasse | 146 |
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!!