getting rte(java) in LPATH.

problem link: http://www.codechef.com/problems/LPATH
why am i getting rte(nzec) in java? but i got ac when i submitted the same solution in cpp.
here is my java implementation: http://www.codechef.com/viewsolution/6374684
here is my cpp implementation: http://www.codechef.com/viewsolution/6361430