Блог пользователя _asmah98

Автор _asmah98, история, 5 лет назад, По-английски

I know it is an overkill to use Priority Queue in recent Div 2 problem C but why does using it gives TLE on test case 32 in problem C ? isn't it O(nlogn), which should pass ?

Link to Submission

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
5 лет назад, # |
Rev. 3   Проголосовать: нравится +1 Проголосовать: не нравится

It is possible to use Priority Queue without getting TLE. check My submission

But our implementations are different and no of Queue operations are higher in your solution. Maybe optimizing could get you off TLE. I have trouble understanding your code so i don't have any suggestions. Good luck tho :)

Edit: fixed the link No i can't :\ link : https://codeforces.me/contest/1348/submission/78739940

»
5 лет назад, # |
  Проголосовать: нравится +7 Проголосовать: не нравится

Yes. The Priority Queue is O(nlogn) but string comparison is very costly O(n) so the overall time complexity is O(n^2logn)