I have a problem with a DSU problem:

Правка en2, от tkien1707, 2024-04-28 18:49:44

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 belong 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.

Теги dsu

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский tkien1707 2024-04-28 18:49:44 24
en1 Английский tkien1707 2024-04-28 18:48:39 539 Initial revision (published)