题库练习 Sereja and Contests
← 上一题 下一题 →

A9445 | Sereja and Contests

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

The first line contains two integers: $x$ $(1<=x<=4000)$ — the round Sereja is taking part in today, and $k$ $(0<=k<4000)$ — the number of rounds he took part in.

Next $k$ lines contain the descriptions of the rounds that Sereja took part in before. If Sereja took part in one of two simultaneous rounds, the corresponding line looks like: "1 $num_{2}$ $num_{1}$ " (where $num_{2}$ is the identifier of this $Div2$ round, $num_{1}$ is the identifier of the $Div1$ round). It is guaranteed that $num_{1}-num_{2}=1$ . If Sereja took part in a usual $Div2$ round, then the corresponding line looks like: "2 $num$ " (where $num$ is the identifier of this $Div2$ round). It is guaranteed that the identifiers of all given rounds are less than $x$ .

输入格式

Print in a single line two integers — the minimum and the maximum number of rounds that Sereja could have missed.

输出格式

In the second sample we have unused identifiers of rounds 1, 6, 7. The minimum number of rounds Sereja could have missed equals to 2. In this case, the round with the identifier 1 will be a usual $Div2$ round and the round with identifier $6$ will be synchronous with the $Div1$ round.

The maximum number of rounds equals $3$ . In this case all unused identifiers belong to usual $Div2$ rounds.

输入输出样例

输入 #1
3 2
2 1
2 2
输出 #1
0 0
输入 #2
9 3
1 2 3
2 8
1 4 5
输出 #2
2 3
输入 #3
10 0
输出 #3
5 9
C++ 编辑器
输入
输出