Hi all, This is the problem link: http://www.spoj.com/problems/ANARC05B/ my solution: http://ideone.com/irmtrP
Previously it was giving NZEC but after adding the try catch block it gives WA. I can't figure out what's going wrong. I have tried all the test cases available on the page(from the comments section) and got correct answer for all those test cases. Still I get WA. Please help me if there is anything that I missed out. Thanks.