#P10378. [GESP202403 七级] 交流问题
[GESP202403 七级] 交流问题
Background
Related multiple-choice and true/false questions: https://ti.luogu.com.cn/problemset/1147.
Problem Description
students from two schools and gather together to communicate with each other. For convenience, we number these students from to . They have conducted communications. In the -th communication, the students numbered and discussed topics they were interested in and became new friends.
Since the purpose of this event is to promote friendship between the two schools, only students from different schools communicate with each other. Students from the same school do not communicate with each other.
As an advisor of school , you are very interested in the size of school . You want to find the minimum possible number of students in school , and the maximum possible number of students in school .
Input Format
The first line contains two positive integers, representing the number of students and the number of communications .
The next lines each contain two integers , representing one communication.
Output Format
Output one line with two integers separated by a single space, representing the minimum possible number of students in school and the maximum possible number of students in school .
4 3
1 2
2 3
4 2
1 3
7 5
1 2
2 3
4 2
5 6
6 7
2 5
Hint
Constraints
- For of the testdata, , .
- For of the testdata, , .
- For all testdata, , . The input is valid, meaning that every communication is guaranteed to be between students from different schools.
Translated by ChatGPT 5