Gift Rift Problem

Hi all !! This is my code for the question gift rift http://www.codechef.com/problems/SAD# … but everytime when i tried to run it gives me WRONG ANSWER error … the solution is working fine on my laptop … Any solution is appreciated … Thanks in advance !!!

http://www.codechef.com/viewsolution/2684705

@grudra77 : You should have :

if(count==(a-1)) {

// meaning all entries except itself are bigger

System.out.println(temp) ; return ;

}

Also the function solve matrix should end with the statement :

System.out.println(“GUESS”)

GUESS should be printed if no row exists whose min is not a max in its column . Not otherwise .

Sir but GUESS would only be printed when there is no such value… How come it would affect the answer if its not the last statement of the function and in my solution count1==a tells that it has traversed all the row and still it cannot find the desired solution.If it ,otherwise, it would print that value.