O(N log N) solution not working for this problem.

Правка en1, от AvadaKedavara, 2024-01-04 05:23:40

In the problem Swaps [problem:https://codeforces.me/problemset/problem/1573/B], my solution which is of O(n log n) time complexity is not working and giving a tle on test 2, when clearly the problem allows O(n log n) to pass. My solution: [submission:https://codeforces.me/contest/1573/submission/240104987]. Can somebody explain why this is happening. I know that there is a better solution in the editorial but why should this not pass?

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский AvadaKedavara 2024-01-04 05:50:14 32 Tiny change: ' not pass?' -> ' not pass?\n\nUpdate: Fixed the problem :>'
en1 Английский AvadaKedavara 2024-01-04 05:23:40 489 Initial revision (published)