### CP_Sucks's blog

By CP_Sucks, history, 20 months ago,

I tried to implement recent div2B with as optimised constant as i could. Can someone tell why my solutions TLE. It Tled 7 times in contest. I tried many approaches

eg submissions

https://codeforces.com/contest/1287/submission/68278756

https://codeforces.com/contest/1287/submission/68277154

Can someone tell why the first submission TLE on TC 10

• -1

 » 20 months ago, # |   +1 don't use set "gone"
•  » » 20 months ago, # ^ |   +3 Yes it worked and thanks https://codeforces.com/contest/1287/submission/68282646
•  » » » 20 months ago, # ^ |   0 Yes, I had the same issue, I would say that having a set there is quite expensive. Remember than the complexity is logn => ~2, now multiply 30*2 Overall complexity would be N^2*k*log3 => (1500^2)*30*2 
 » 20 months ago, # | ← Rev. 3 →   +1 getting same, but then made some changesstring str = str + "abs" is slower than str+="abs"endl is slower than "\n" used u-map instead of mapbut i don't like the it, it should not be tle. author must check.