I am not willing to write this blog because in many previous blogs i was flooded with downvotes but i will write because I need a help(I also do not have a friend which is proficient in java to whom i can discuss) from fellow coders in debugging which i am not able to find from last 2 hrs and 10 submission with 7RTE AND 24 AC every time.
I even use LONG , sort array of pairs even in equal case on the basis of index..still not able to figure out the reason of failure.
Q link — https://atcoder.jp/contests/abc187/tasks/abc187_d
My soln link https://atcoder.jp/contests/abc187/submissions/19167083
EVERY TIME I GOT RTE ON FOLLOWING TC- 16,17,18,20,21,22,25
HELP IS HIGHLY APPRECIATED.
https://atcoder.jp/contests/abc187/submissions/19168350
Since you are comparing long values, use Long.compare() in the Comparator.