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.me/contest/1287/submission/68278756
https://codeforces.me/contest/1287/submission/68277154
Can someone tell why the first submission TLE on TC 10
don't use set "gone"
Yes it worked and thanks https://codeforces.me/contest/1287/submission/68282646
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
getting same, but then made some changes
string str = str + "abs" is slower than str+="abs"
endl is slower than "\n"
used u-map instead of map
but i don't like the it, it should not be tle. author must check.