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

Автор salt_n_ice, 3 года назад, По-английски

Link
I tried solving this using the ordered_set gnu pbds
I did dfs along with using swap and move methods for merging the sets of each node's children. The time complexity should be nlogn but why is it giving TLE on test 15?

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

»
3 года назад, # |
  Проголосовать: нравится -16 Проголосовать: не нравится

Don't act like you really know how move works like, it's much more difficult than one can imagine. Read this.

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

x.swap(ret). I also believe that ordered_set is not the intended solution anyway.

and move is useless here