Runtime error in Java code for Problem CLEANUP

Dear All,

I am facing a runtime error for my java solutions to problem CLEANUP. I have tried two approaches one using arrays and other using a priority queue. The Submissions are here and here. I dont get run time error in the testcases provided. These are small inputs. Kindly help me in finding the runtime error. I would appreciate if you could provide or point me to large inputs.


Runtime error occurs when you don't accept enough inputs in your program which codechef java compiler(or executor whatever you say) gives.

For eg. Suppose program expects you to accept 3 user inputs.

However in your program you are accepting only 2 inputs , you will get Runtime error…

So just check whether you have accepted all the inputs that program expects you to accept.

Go through the question once again and accept all the inputs.

Hope this solution helps.

Comment if you still get the error.

And put code in try catch block too.

//code goes here

catch(Exception e)