yesbutno1685's blog

By yesbutno1685, history, 4 years ago, In English

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

Code
  • Vote: I like it
  • +3
  • Vote: I do not like it

| Write comment?