Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

Ordering Issue Causing TLE

Правка en1, от muichirotokito, 2024-07-23 07:09:10

Hi Everyone, I am currently stuck at this problem : https://mirror.codeforces.com/contest/1253/problem/D

AC code : https://mirror.codeforces.com/contest/1253/submission/271988149

TLE code : https://mirror.codeforces.com/contest/1253/submission/272003978

I am trying to solve it by using DSU. My solution is getting accepted when I am sorting the edges in descending order. The only difference is that I have removed the sort in the code which is giving TLE.

My understanding is that ordering of edges should not matter for this problem and I also don't think the issue is DSU operations because I am using the union by rank.

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский muichirotokito 2024-07-23 07:09:10 648 Initial revision (published)