Hello,
I have been spinning my head around this test case for a while now.
Could you please provide the full test case grid?
I thought it was the overflow of the unsigned long long value, but this didn't work.
I thought it was the memory limit, but apparently this wasn't the case.
I tried to mimic the grid by using this form;
0 3 3 3 3 3 3 3 3
And then, my solution outputs the correct value of 3 in the missing cell. (Isn't it?)
Any hints will be appreciated!
Thank you!
Problem Link: http://mirror.codeforces.com/contest/711/problem/B Problem Solution: http://mirror.codeforces.com/contest/711/submission/20392397
You are not checking that the columns all add up the same. You are only checking the rows and the diagonals.
Thank you, Quim, but I do already check the columns here;
I meant the rows. You are filling the missing row but not checking that all others have the same value.
You don't check if the diagonal sums are correct.
As for the post itself, you should learn to calculate roughly how much memory you're using so you know if you've exceeded the limit or not (you only have a very small bidimensional array, so you should be very far from it -- try calculating how much memory you used). You should also learn when overflows are a problem (in this case, no operation will go over 1018, so they can't be).
Thank you ffao, but I do already check the diagonals;
Thanks for your advice about memory limits and data type ranges.
You're checking if the diagonals are the same, but they can be both incorrect.