Today, during the contest, the problem 1546/B showed all pretests passed(4 pretests). Later it failed the system test and showed TLE on testcase-4 (but pretest-4 was initially passed during contest). I again submitted the exact same code a while ago, and now got accepted. I can't really understand what's going on...
Contest time code- https://codeforces.net/contest/1546/submission/122111498
The same code I ran after contest- https://codeforces.net/contest/1546/submission/122141000
See, both the codes are exactly same.
The question is how?
yes
this is a similar solution which gets tle 122133864 But testcases for B are weak, this slightly modified solution gets accepted in 46ms 122134450
[Edit]: ans=ans+char('a'+j); is slow(O(n) maybe) i replaced it with cout<<char('a'+j); (31ms) 122142595
okay, thanks a lot
A tip, use array/vector for storing the frequency of alphabets, instead of a map, this is a proof that an extra $$$log$$$ factor can bring such a change.
okay, thanks a lot