I have a problem with a DSU problem:

Revision en1, by tkien1707, 2024-04-28 18:48:39

Devide n vertical into 2 group A and B.

There are q query of two type: 1 u v, tell you that u and v belong to different group; 2 u v, print "YES" if u and v belong to one group, "NO" if u and v not be long to one group, "NOT GIVEN" if there is not enough information about u and v, based on the information has given in query type 1;

For example: Input: 3 5 2 1 2 1 1 2 2 1 2 1 2 3 2 1 3 Output: NOT GIVEN NO YES I have stucked in this problem for a week, please help me ToT.

Tags dsu

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English tkien1707 2024-04-28 18:49:44 24
en1 English tkien1707 2024-04-28 18:48:39 539 Initial revision (published)