I'm stressed out because of the error (I think only in my computer)
I was able to compile it on this wepsite (https://www.onlinegdb.com/online_c++_compiler) but only fail in my computer.
Anyone who knows why...?
plz help me out
you can only check (int sum[505][505]; //// This part is causing that error) this line
The error is enter image description here
int N;
cin >> N;
int input[500][500];
int sum[505][505]; //// This part is causing that error
You're allocating (500*500 + 505*505) * sizeof(int) = 2020100
bytes on the stack. Your stack isn't that big, so it overflows.
You'd be better off using dynamic memory, e.g. by means of a vector<>
:
vector<vector<int>> input(500, vector<int>(500));
User contributions licensed under CC BY-SA 3.0