Logical_Operator's blog

By Logical_Operator, history, 3 years ago, In English

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.

  • Vote: I like it
  • -5
  • Vote: I do not like it

»
3 years ago, # |
  Vote: I like it 0 Vote: I do not like it

The question is how?

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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

»
3 years ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

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.