Hi all, I need help to figure out why my submission for Codeforces #751 Div 2 — Problem D — Frog Traveler, is giving TLE. Here is my submission link — https://codeforces.com/contest/1602/submission/133185501 ... I use Java. Tried the approach with a TreeSet and without it, but there seems to be a fundamental flaw in my code.
I would be grateful for any help. Thanks.