chefhack -WA

I tried it several times but wrong answer.
its running in all test cases i tried.
Can any1 provide me test cases where i go wrong?or any help…
my soln is:CodeChef: Practical coding for everyone
i have used a different method…

1.for prime,i used seive amd marked the numbers which are prime,then binary search to get the index or count of prime…

2.i am looping normally in 2d grid.
any number will have 4 neighbours.if we traverse the grid,cost of 3 neighbours of even/odd number will always have been calculated by now if we keep on marking even/odd neighbours and the cost of given server is known.further all its even/odd immediate neighbour which was not marked will be marked 0 now.

actually,if number is even,we find its 4 neighbours.if any neighbour is even and its answer matrix is marked we return 1.so the cost for arr[i][j] server is 0.if none of its even neighbour is marked,
we mark their cost as 0 because the number which called them is even.

All i say that we dont need dfs.
just traverse grid and keep on marken neighbours.
its working fine.
can anybody help?
any test case…

Nope. Just traversing the grid is not enough.
Consider this simplest case:
3
4 1 4
4 4 4
1 1 1

When you consider the very first 4 you should mark all other fours by dfs.
But using your method you mark only one four at the cell[2][1]
and when consider the four at the cell[1][3] will count it.