Help with TLEs

Правка en2, от yesbutno1685, 2020-09-17 07:36:41

I have a question on this question: https://mirror.codeforces.com/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://mirror.codeforces.com/contest/1409/submission/93014244 [](https://mirror.codeforces.com/contest/1409/submission/93014244)

Code

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский yesbutno1685 2020-09-17 07:37:07 62
en2 Английский yesbutno1685 2020-09-17 07:36:41 8
en1 Английский yesbutno1685 2020-09-17 07:36:19 3920 Initial revision (published)