KP56's blog

By KP56, history, 21 month(s) ago, In English

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

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

| Write comment?
»
21 month(s) ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

unordered_sets are slow. you shouldn't use them

»
21 month(s) ago, # |
Rev. 2   Vote: I like it +28 Vote: I do not like it

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.