#P6268. [SHOI2002] 舞会

    ID: 7058 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>2002各省省选网络流上海图论建模二分图

[SHOI2002] 舞会

Problem Description

A school is going to hold a ball. Among all nn 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 nn and mm. Here, nn is the total number of students that can be considered, and mm is the number of known pairs of students who have danced before (n1000n \leq 1000, m2000m \leq 2000).

Then follow mm 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 00 to n1n - 1.

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