How does this code TLE aka Iteration over set/multiset not linear?
Difference between en1 and en2, changed 99 character(s)
I submitted this [submission:311120546] solution to the recent contest [contest:2075].↵

I was pretty sure my solution is N^2, and I didn't see a reason why it should TLE. Right after submitting I was a bit surprised that the solution took like 1.5s but I thought whatever, there's no way it gets TLE.↵


How come this code takes over 2s? The only explanation I can see is that the iteration over multiset is not linear which is what I thought for quite a long time.




UPD1: The TLE is because of using a list??? When I use a vector instead, it passes in 500ms

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Filikec 2025-03-18 15:02:05 99 Tiny change: 'long time.' -> 'long time.\n\n\n\nUPD'
en1 English Filikec 2025-03-18 12:33:41 535 Initial revision (published)