E. Just C3 has ended

4.8

5 votes
Problem

Now, C3 has ended so, you all wants to go for a party. In party all the students who have same behavior ( Some are stalkers, some are padhaku , some are programmers ,  etc....) will go together in a group. If a student's behavior doesn't matches with any other student then he will go alone for party (i.e. in a group of size 1 xD). You have to find total number of groups and the size of that group which have maximum people respectively. 

Input:

The first line consists of two integers N and M denoting the number of students(this means list of all students is 1, 2, 3, ....., N) and the number of pairs respectively.
The next M lines consists of two integers u and v denoting that student u and student v are of same behavior. u and v can never be equal and pairs are not repeated.

Output:

Two integers x  and y i.e. total number of groups and the size of that group which has maximum people respectively. 

Constraints:

1N105

1M105

1u,vN

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation
Here 1 does not have any friend with same behavior So, he will go alone in a group of size of 1.

2, 3 , 4 have same behavior So, they will go together in another group of size 3.

So, total number of groups = 2 and the size of that group which has maximum people= 3.

Editor Image

?