logo AlgoBeat OnlineJudge
登录 注册

#102011. [BZOJ 2011] [Ceoi2010]Mp3 Player

内存限制:259 MiB 时间限制:5000 ms 标准输入输出
题目类型:传统 评测方式:文本比较
上传者: 匿名

题目描述

Georg 有个 MP3 Player,没有任何操作 秒钟就会锁定,这时按下任意一个键就会变回没锁定的状态,但不会改变频道。只有在没锁定的状态下按键才有可能改变频道。MP3 的频道为 ,如果现在是 频道,若 ,在无锁状态下按 + 就会加 。若 ,在无锁状态下按 - 就会减 。Georg 忘记了 MP3 的 是多少。他想通过一段操作试验一下。然后他就写下他的操作顺序和最后停留的频道 ,然后就给你了,你要求的是 的最大值和 在这个值的情况下,第一个操作前的频道 的最大可能数。

输入格式

第一行: 表示 Georg 操作了 次;

以下 行,每行第一个为字符 ,第二个为数字 ,表示 Georg 在 秒按下了 键。

输出格式

输出 的最大值和 在这个值的情况下,第一个操作前的频道 的最大可能数。

为无限大时经过这段操作最后能停在 ,则输出 infinity

样例

样例输入 #1

6 4 3
- 0
+ 8
+ 9
+ 13
- 19
- 24

样例输出 #1

5 4

样例说明 1

For the keys perform the following actions: unlock, unlock, +, +, unlock, -. For any we would get . Note that the output contains the largest possible . For the last two keystrokes will both be active, hence it will be impossible to have .

样例输入 #2

3 10 10
+ 1
+ 2
+ 47

样例输出 #2

infinity

样例说明 2

If then for any we'll have .

数据范围与提示

对于 的数据,

对于 的数据,

对于 的数据,