Pal's blog

By Pal, history, 4 years ago, In English

it is giving TLE in some of test cases

here is link to my code https://cses.fi/paste/3b8de947940f05b018bda3/

  • Vote: I like it
  • +8
  • Vote: I do not like it

| Write comment?
»
4 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Erase function in Vector takes O(n) complexity so it will cause TLE. We have to use ordered set which takes O(log n) complexity for erase function. For more information You Can refer to these links-