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

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

In the previous contest I submitted a solution which got accepted but right now it says "Time limit exceeded". When I try to resubmit it, it keeps failing test 5. Any ideas why it's not efficient enough?

https://codeforces.com/contest/1722/submission/170472282

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

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

unordered_sets are slow. you shouldn't use them

»
21 месяц назад, # |
Rev. 2   Проголосовать: нравится +28 Проголосовать: не нравится

std::find(begin, end) works in linear time, not constant time, it cannot exploit any internal structure of the container. Use container's methods.

Should be easy to reproduce with a big local test.