DSU vs kuhn

Revision en1, by err0r, 2018-08-24 12:20:54

i have solved two similar problem recently 1027F & 875F

To solve 1027F i tried approach this problem using binary search and dsu but i am getting tle but my straightforward solution using kuhn`s algorithm got AC.

Can anyone explain the reason behind it? why kuhn`s is so fast here and why my dsu with binary search got TLE.

links to my submission

DSU kuhn

and to makes things more complicated for me

875F i tried this problem using kuhn got tle but i got AC using DSU.

links to my submission

DSU kuhn

it will be very helpful if anyone can explain this to me!! when and where should i use DSU or kuhn!!

kind regards

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English err0r 2018-08-24 12:20:54 988 Initial revision (published)