#P6268. [SHOI2002] 舞会
[SHOI2002] 舞会
Problem Description
A school is going to hold a ball. Among all students in the school, it is known that some pairs of students have danced with each other before. Of course, any pair that has danced before must be one boy and one girl.
At this ball, it is required that among the invited students, any pair consisting of a boy and a girl must not have danced with each other before. Find the maximum number of students that can be invited to the ball.
Input Format
The first line of input contains and . Here, is the total number of students that can be considered, and is the number of known pairs of students who have danced before (, ).
Then follow lines. Each line contains two non-negative integers, indicating that the two students with these indices have danced with each other before. Students are numbered from to .
Output Format
The output contains only one line with one number: the maximum number of students that can be invited.
8 6
0 2
2 3
3 5
1 4
1 6
3 1
5
20 5
5 2
4 3
18 17
0 11
13 3
16
Hint
Translated by ChatGPT 5