Summer training is coming soon, and in order to achieve good results in the upcoming contests, everyone wants to find their favorite teammates to form their own dream team!
There are
3n
3n students in the training team with corresponding numbers
1
1 to
3n
3n , and they will form
n
n teams, each consisting of
3
3 students . It is now known that there are
m
m pairs of students
(x_i, y_i)
(x
i
,y
i
) who are directly familiar with each other (i.e.
x_i
x
i
is directly familiar with
y_i
y
i
, and
y_i
y
i
is directly familiar with
x_i
x
i
) .
Friends of friends are friends. We define that student
a
a is familiar with student
b
b if one of the following conditions is met:
1.
a
a is directly familiar with
b
b , or
2. There exists a series of students
x_1,x_2,dots, x_k (k > 0)
x
1
,x
2
,…,x
k
(k>0) satisfies:
a
a is directly familiar with
x_1
x
1
For all
1le i< k
1≤i
HBC252835Counting0and1instring,动态规划Dream Team题解
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。