Блог пользователя karansrivastava

Автор karansrivastava, история, 10 месяцев назад, По-английски

I recently participated in Codeforces Round 895 (Div. 3) and encountered a Time Limit Exceeded (TLE) verdict for problem 1872F - Selling a Menagerie. Despite optimizing my code, I'm still puzzled by the TLE result.

I believe my code, with a time complexity of around O(10*n) which is near about o(n).

My code received a TLE verdict, which I find unexpected given its theoretical efficiency.

Could anyone please examine my code and share insights or optimizations.

Code Link: 222367949

Your assistance would be greatly appreciated.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
10 месяцев назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

startpoints() is actually quadratic because curr is initialized up to n times. You can declare curr before the loop and make sure to undo the 1s each iteration