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.
https://mirror.codeforces.com/contest/1467/submission/103815290
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!!