Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

muichirotokito's blog

By muichirotokito, history, 4 hours ago, In English

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

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

TLE code : https://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.

Full text and comments »

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