I have implemented the editorial of PISHTY AND TREE step by step as it is in JAVA. However I get tle in one case of advanced(70 points) and run error in the other.First 30 points works correctly.
Here is the link of my solution:
Link of question:
Where am I going wrong?
Update: Run Error has been rectified. Still getting TLE.
Update: Got AC(100 points) . Works correctly now