Chefimprs problem with a test case

1
5 5
1 2 3 4 5
6 5 4 3 2
2 3 4 5 6
5 4 3 2 1
0 0 0 0 0
i have made this case worked on one of the correct codes and it is giving -1.
but i am getting answer as
3 2 0 2 3
6 5 5 5 6
4 3 5 3 4
2 1 4 1 2
0 0 4 0 0
though i am getting wrong_answer as judgement but could you please tell me why so it is happening and can any body please tell where my solution is getting wrong.
link to solution CodeChef: Practical coding for everyone
my approach is i had first seen the value of m as even or odd.
if m is even,
“then i will see that all the elements in matrice occur even no. of times.”
if m is odd
“there should be (n*m -n) numbers all occuring even number of times and n numbers are used as middle element of column (n can be either odd or even).”
please tell if there is some problem in my approach

will u please give the link of that solution >>

which solution correct one you are asking

this one.

https://www.codechef.com/viewsolution/33304978

As u have used 0 in your last row. and in constraints Ai is greater than 1 .
when u change 0 to any other element. so it will give right answer.