nzec runtime error in java

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

my solution compiled on ideone.com without any error but codechef is not accepting it?

@asheshvidyut : nzec runtime error is due to runtime error ( like your code throwing an exception when running on a particular input ) . Even if your code compiles correctly and gives correct output on some sample cases , it can throw an exception of different inputs . CodeChef has not given you compile error so compiling fine on ideone.com doesn’t prove anything . Also running fine on some sample test cases does make your code error proof .
For me to point out the problem in your code , please give a link to problem statement also . Only then can I see your solution and find the error .

1 Like

@asheshvidyut :
I ran your code in ideone with the following input :
1 (number of test cases )
50 0 0 1 1 100000 ( input for 1st test case ).
And it gives run time error :
Exception in thread “main” java.lang.StackOverflowError
at java.util.Vector.indexOf(Vector.java:404)
at java.util.Vector.contains(Vector.java:363)
at Main.evalAll(Main.java:45)
at Main.evalAll(Main.java:60)
at Main.evalAll(Main.java:60)
at Main.evalAll(Main.java:60)
at Main.evalAll(Main.java:60)
at Main.evalAll(Main.java:60)
at Main.evalAll(Main.java:60)
at Main.evalAll(Main.java:60)
at Main.evalAll(Main.java:60)
…

I guess that gives you a test case to improve your attempt .

1 Like

thank you sir