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

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

Unable to understand where my submission is failing. It looks like a standard DSU question. WA on TC-14.

https://codeforces.me/contest/755/submission/80885849

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

»
6 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

You have a bug in the union function, you should set parents of p1, p2 instead of x1, x2.

Also, this standard DSU question can be solved by counting a number of different values in the input sequence :)