CF567B.Berland National Library
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected works of Berland leaders, the library has a reading room.
Today was the pilot launch of an automated reading room visitors' accounting system! The scanner of the system is installed at the entrance to the reading room. It records the events of the form "reader entered room", "reader left room". Every reader is assigned a registration number during the registration procedure at the library — it's a unique integer from 1 to 106. Thus, the system logs events of two forms:
- "+ r__i" — the reader with registration number r__i entered the room;
- "- r__i" — the reader with registration number r__i left the room.
The first launch of the system was a success, it functioned for some period of time, and, at the time of its launch and at the time of its shutdown, the reading room may already have visitors.
Significant funds of the budget of Berland have been spent on the design and installation of the system. Therefore, some of the citizens of the capital now demand to explain the need for this system and the benefits that its implementation will bring. Now, the developers of the system need to urgently come up with reasons for its existence.
Help the system developers to find the minimum possible capacity of the reading room (in visitors) using the log of the system available to you.
伯兰国家图书馆最近在伯兰首都建成。此外,图书馆还收藏了所有伯兰领导人的著作,并设有阅览室。
今天,一套自动化的阅览室访客统计系统正式投入试运行!该系统的扫描仪安装在阅览室入口处,用于记录两类事件:“读者进入阅览室”和“读者离开阅览室”。每位读者在图书馆注册时都会被分配一个注册编号——这是一个 1 到 106 之间的唯一整数。因此,系统日志中包含以下两种格式的事件:
+ _r__i_—— 注册编号为 r__i 的读者进入阅览室;\- _r__i_—— 注册编号为 r__i 的读者离开阅览室。
系统首次成功启动并持续运行了一段时间;但在系统启动时刻及关闭时刻,阅览室内可能已存在读者。
伯兰政府为该系统的设计与安装投入了大量财政资金。因此,首都部分市民如今要求解释:为何需要这套系统?它又能带来哪些实际效益?目前,系统开发人员亟需迅速提出其存在的合理理由。
请协助系统开发人员,根据您所掌握的系统日志,计算出阅览室(以读者人数计)的最小可能容量。
输入格式
The first line contains a positive integer n (1 ≤ n ≤ 100) — the number of records in the system log. Next follow n events from the system journal in the order in which the were made. Each event was written on a single line and looks as "+ r__i" or "- r__i", where r__i is an integer from 1 to 106, the registration number of the visitor (that is, distinct visitors always have distinct registration numbers).
It is guaranteed that the log is not contradictory, that is, for every visitor the types of any of his two consecutive events are distinct. Before starting the system, and after stopping the room may possibly contain visitors.
第一行包含一个正整数 n(1≤n≤100)—— 系统日志中的记录条数。接下来的 n 行按事件发生顺序给出系统日志中的 n 个事件。每个事件独占一行,格式为 “+ ri” 或 “- ri”,其中 ri 是一个介于 1 到 106 之间的整数,表示访客的注册编号(即:不同访客的注册编号互不相同)。
保证日志内容不自相矛盾,即:对任意一位访客,其任意两个连续事件的类型均不相同。系统启动前及停机后,房间中可能仍有访客存在。
输出格式
Print a single integer — the minimum possible capacity of the reading room.
输出一个整数——阅览室的最小可能容量。
输入输出样例
输入#1
6 + 12001 - 12001 - 1 - 1200 + 1 + 7
输出#1
3
输入#2
2 - 1 - 2
输出#2
2
输入#3
2 + 1 - 1
输出#3
1
说明/提示
In the first sample test, the system log will ensure that at some point in the reading room were visitors with registration numbers 1, 1200 and 12001. More people were not in the room at the same time based on the log. Therefore, the answer to the test is 3.
在第一个样例测试中,系统日志将确保在阅览室的某一时刻存在注册号为 1、1200 和 12001 的访客。根据日志,同一时刻阅览室内不存在更多的人。因此,该测试的答案为 3。
输入解题思路,AI测评打分。不知道怎么写?