CHEFHACK- Runtime error

I m getting runtime error(NZEC) in [CHEFHACK][1] problem.Can anyone plz tell me what is the problem.Here is my


[2].thanks in advance...


  [1]: http://www.codechef.com/problems/CHEFHACK
  [2]: http://www.codechef.com/viewsolution/1790006

@progpassion : Consider the test case :
1 ( number of test cases )
1 ( value of n )
9999999 ( the actual value in the grid ) .
Your output is :
Exception in thread “main” java.lang.ArrayIndexOutOfBoundsException: 9999999
at Main.main(Main.java:54)
You are making array of size 9999999 , but you need to handle numbers from 0 to 9999999 , so you need an array of size 10000000 .

1 Like

I have corrected my


[1],but still getting a runtime error.Can it be an exception of stack overflow?


  [1]: http://www.codechef.com/viewsolution/1844759
//