The editorial gives a DP solution, but the first thing that came to my mind was a range max query on the distance between frogs. I’ve used a Sparse Table as my RMQ, however it gives a fatal runtime error (SIGABRT) while submitting. Can someone help me find the error in my approach?
( I’ve handled duplicate values with a condition
s !- e ).