CF401B.Sereja and Contests

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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

Next kk 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 num2num_{2} num1num_{1} " (where num2num_{2} is the identifier of this Div2Div2 round, num1num_{1} is the identifier of the Div1Div1 round). It is guaranteed that num1num2=1num_{1}-num_{2}=1 . If Sereja took part in a usual Div2Div2 round, then the corresponding line looks like: "2 numnum " (where numnum is the identifier of this Div2Div2 round). It is guaranteed that the identifiers of all given rounds are less than xx .

输入格式

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 Div2Div2 round and the round with identifier 66 will be synchronous with the Div1Div1 round.

The maximum number of rounds equals 33 . In this case all unused identifiers belong to usual Div2Div2 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

说明/提示

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 Div2Div2 round and the round with identifier 66 will be synchronous with the Div1Div1 round.

The maximum number of rounds equals 33 . In this case all unused identifiers belong to usual Div2Div2 rounds.

首页