P28052 [洛谷] [GESP202403 Level 7] Communication Issue
普及+
题目描述

Problem Description

$n$ students from two schools, $A$ and $B$, gather together to communicate with each other. For convenience, we number these students from 1 to $n$. They conducted $m$ sessions of communication. In the $i$-th session, students numbered $u_i$ and $v_i$ discussed their interests and became new friends.

Since the purpose of this gathering is to promote friendship between the two schools, only students from different schools communicate. Students from the same school do not communicate with each other.

As an advisor from School $A$, you are very interested in the size of School $B$. You want to determine the minimum and maximum number of students from School $B$.

Input Format

The first line contains two positive integers, representing the number of students $n$ and the number of communication sessions $m$.
The next $m$ lines each contain two integers $u_i$ and $v_i$, representing a session of communication.

Output Format

Output a single line with two integers separated by a single space, representing the minimum and maximum number of students from School $B$.

Sample Input and Output

Sample Input #1

4 3
1 2
2 3
4 2

Sample Output #1

1 3

Sample Input #2

7 5
1 2
2 3
4 2
5 6
6 7

Sample Output #2

2 5

Notes

Data Size and Constraints

  • For $30\%$ of the data, it is guaranteed that $n \leq 17$ and $m \leq 50$.
  • For $60\%$ of the data, it is guaranteed that $n \leq 500$ and $m \leq 2000$.
  • For all test data, it is guaranteed that $1 \leq u_i, v_i \leq n \leq 10^5$ and $1 \leq m \leq 2 \times 10^5$. The input is valid, meaning that the communication is always between students from different schools.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
4 3 1 2 2 3 4 2
样例输出
1 3