Help Needed in MOON

PROBLEM: https://www.codechef.com/GHC32020/problems/MOON
This is my AC soln
https://www.codechef.com/viewsolution/30747879
I tried solving this problem using one loop and getting WA in last test
https://www.codechef.com/viewsolution/30749379
Can someone tell me the mistake in my second soln?

Try this
4 0 4 0

working fine

Try this
4 4 4 4
0 0 0 0
0 4 4 0
1 3 3 1
4 0 0 4

working fine

Look for last test case to pass,
sum=(nx)+(my).
You have to check only sum%2==0.
Just put this condition and check your last test case will show AC

I was talking about this test not the general test case provided for the question

Try test case-
1 0 0 0
Your solution fails for this tc

1 Like

Thanx bro…I totally forgot that case …

Yes I now it, but if you check sum%2==0 your last test case will pass,
https://www.codechef.com/viewsolution/30734939

For this test case
0 1 0 0
Answer is no
This code prints yes
https://www.codechef.com/viewsolution/30749542