I have a question on this question: https://codeforces.net/problemset/problem/1409/E
I am getting a TLE on test five (or when n hits its maximum value). My code gives the correct answer, given infinite amount of time, I just need help on figuring out why it TLEs.
From my knowledge, all I do is binary search and do a linear scan, so that's about nlgn time. However, when I submit it, it does not run in time, so I suspect that there is something that I am not catching. I've tried for a long time and still could not figure out why my code is TLE-ing.
I hope you guys can help me out
Thanks in advance!
code (in java): https://codeforces.net/contest/1409/submission/93014244 [](https://codeforces.net/contest/1409/submission/93014244)