Codeforces Round #Pi (Div. 2)567B Berland National Library(模拟)

LVGL实战 透视卡盘 八张卡立在一个圆柱面上,摄像机在柱心前方。每帧对屏幕上的每个像素发一条射线,与卡片所在平面求交,得到三维交点,再投影回卡片自己的二维坐标系取样。透视、倾斜、近大远小、相互遮挡 —— 全部是这一步的副产物。 阅读详情

B. Berland National Library
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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 aregistration 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:

  • "+ ri" — the reader with registration number ri entered the room;
  • "- ri" — the reader with registration number ri 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.

Input

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 "+ ri" or "- ri", where ri 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.

Output

Print a single integer — the minimum possible capacity of the reading room.

Sample test(s)
input
6
+ 12001
- 12001
- 1
- 1200
+ 1
+ 7
output
3
input
2
- 1
- 2
output
2
input
2
+ 1
- 1
output
1
Note

In the first sample test, the system log will ensure that at some point in the reading room were visitors with registration numbers 1, 1200and 12001. More people were not in the room at the same time based on the log. Therefore, the answer to the test is 3.




给出n组数据, + 代表进入图书馆, - 相反,问图书馆最少可能容量。


先统计出 + 的数据,遇到 - 若已经在图书馆则不算这个人,若不在图书馆容量加1。


AC代码:


#include "iostream"
#include "cstdio"
#include "cstring"
#include "algorithm"
using namespace std;
const int maxn = 1e6 + 5;
int main(int argc, char const *argv[])
{
	int n, ans = 0, x, num = 0;
	char c;
	bool a[maxn] = {false};
	cin >> n;
	for(int i = 0; i < n; ++i) {
		cin >> c >> x;
		if(c == '+') {
			a[x] = true;
			num++;
			ans = max(ans, num);
		}
		else {
			if(a[x]) num--;
			if(!a[x]) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


【unity实战】Unity2D TileMap的探究(最简单,最全面的TileMap使用介绍) 之前有人在微信上找我,问了TileMap相关的知识【unity实战】随机地下城生成2——绘制地图Tilemap的使用及一些技巧的使用(含源码)不过写的不是特别不是特别细致,只是简单的用了一下,所有这次特地打算单独写一篇文章,来介绍一下,下次还有人问我,我直接就把这篇文章丢给他,完美!Unity的Tilemap 一般称之为瓦片地图或者平铺地图,是 Unity2017 中新增的功能,主要用于快速编辑 2D 游戏中的场景,通过复用资源的形式提升地图多样性。Tilemap是一个用于创建2D地图的工具。 阅读详情

相关推荐

新手也能搞定的ANPC三电平逆变器Simulink仿真:从SPWM调制到开关损耗优化

本文详细介绍了如何在Simulink中搭建ANPC三电平逆变器仿真模型,从SPWM调制基础到开关损耗优化技巧。通过分层设计思路和实用代码示例,帮助新手快速掌握ANPC拓扑的核心功能,包括中点平衡控制和性能指标分析,为电力电子系统设计提供实践指导。

weixin_30335575的博客 405

Berland National Library

Description 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 area

my name is BUG 723

SIPVicious实战指南:从零开始掌握VoIP渗透测试(Kali Linux环境)

本文为SIPVicious实战指南,详细介绍了在Kali Linux环境下进行VoIP渗透测试的完整流程。从环境准备与工具安装开始,逐步讲解如何使用svmap扫描SIP服务器、svwar枚举PBX分机号,以及svcrack进行密码安全测试,并整合svreport生成报告。旨在帮助安全从业者从零开始,系统掌握这套经典开源工具,在授权范围内有效评估VoIP系统的安全性。

weixin_29327977的博客 535

Codeforces Round #Pi (Div. 2) B. Berland National Library

B. Berland National Library time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland National Library has rec

习惯与规则决定命运 1227

Hyper-V创建Ubuntu虚拟机设置固定IP

本文记录使用hyper-v创建ubuntu虚拟机,为虚拟设置固定IP且通过物理机可访问。

2622

正交试验-方差分析-数据展现形式

方差分析(ANOVA, Analysis of Variance)用于比较多个组之间的均值差异,确定因素对响应变量的显著性影响。示例分析。

m0_58326994的博客 1967

Berland National Library(模拟题目)

Berland National Library Time Limit: 1000MSMemory Limit: 262144KB64bit IO Format: %I64d & %I64u Submit Status Description Berland National Library has recently been built in the cap...

weixin_34329187的博客 150

在 SAP Fiori 里玩转 Manage Views:把过滤器与列表布局固化成你的默认工作台

本文介绍了SAP Fiori应用中"Manage Views"功能的核心价值和使用方法。该功能允许用户保存和复用个性化界面设置,包括筛选条件、列布局等,将重复操作简化为一次性配置。文章从技术实现、用户操作和治理建议三个维度展开: 功能本质:View存储的是界面状态而非业务模型,是提升个人生产力的工具 核心价值:固化高频操作,支持默认视图设置,实现"开箱即用"的工作状态 操作指南:详细说明了收藏、重命名、设为默认、自动应用等关键功能 治理建议:区分标准视图、个人视图和公

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 125

CF_567B_BerlandNationalLibrary

B. Berland National Library time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland National Library has rec

OTTFF的博客 528

C 语言多文件编程 : 大型程序的组织与管理

本文介绍了C语言多文件编程的核心概念与实践方法。主要内容包括:1. 多文件编程的必要性:解决单文件编程在大型项目中的维护和协作问题;2. 文件组织方式:头文件(.h)负责声明接口,源文件(.c)实现具体功能;3. 编译链接过程:分阶段编译和链接多个源文件;4. 头文件设计原则:包含接口声明、使用保护机制、保持自包含性;5. 模块化实践:通过示例展示学生信息管理系统的模块划分;6. 构建工具:介绍Makefile的编写和使用方法。文章还提供了创建静态库和动态库的指导,并强调了模块化设计、信息隐藏等软件工程原则

2503_91057718的博客 1945

SAP-ABAP:接口多继承与复合接口设计:复杂业务场景下的能力组合实现方案

本文介绍了ABAP中通过接口多继承与复合接口设计实现能力组合的方案。文章首先辨析了类实现多个接口与接口继承接口的核心概念,指出ABAP虽不支持类多继承,但可通过这两种机制灵活组合能力。随后详细讲解了类实现多个接口的语法规则与三种调用方式,并给出了五个基础能力接口的设计示例(日志记录、权限校验、数据导出、消息通知、格式转换)。作者通过对比单继承与接口多重实现的差异,强调后者在解耦和扩展性上的优势,为复杂业务场景下的能力组合提供了实用解决方案。

baidu_35680696的博客 244

CF-- Berland National Library--思维

B. Berland National Library time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Berland National Library has recently been built in th...

lanshan1111的博客 219

agent实战专栏|日程管理Agent:智能时间管家

在快节奏的现代生活中,时间管理已成为每个人面临的核心挑战。根据全球知名调研机构 Gallup 的统计数据,现代职场人平均每天仅能有效专注工作 2 小时 23 分钟,剩余时间被会议、邮件、碎片化事务大量占据。微软的另一项研究显示,知识工作者平均每天需要处理 200 多条日程相关的信息,包括会议邀请、日历变更、提醒通知等。传统的日历工具(如 Google Calendar、Outlook Calendar、Apple Calendar)虽然在可视化展示和基础提醒方面表现出色,但在智能化方面仍存在明显短板:日程管

2201_76125393的博客 52

Codeforces Round #Pi (Div. 2) B. Berland National Library (模拟)

题意,有个图书馆,+表示进人,-表示出人,记录前有人,所以可以没有+ 就有-,问可能的最大值是多少人。 Berland National Library has recently been built in the capital of Berland. In addition, in the library you can take any of the collected

AK_HuangYC的博客 551

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Codeforces Round #Pi (Div. 2)——set——Berland National Library

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 areading roo...

dgjm4087的博客 149

复分析 阿尔福斯(Ahlfors) 第三版答案 英文

答案分为十章,有部分习题没有答案,全英文复分析阿尔福斯(Ahlfors) 第三版答案

Codeforces Round #Pi (Div. 2) B Berland National Library

B. Berland National Library time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Berland National Library has recently been built in the capital

xtulollipop 708

Codeforces Round #Pi (Div. 2) ——B. Berland National Library

这道题我一开始想了很久,但是fst 了。而且赛后想的也不是很清楚,所以有必要把它单独分出来讲清楚。 题意: 现在在log中有n条记录。然后每一条记录都写成:"+ri"或是"-ri"的形式。(其中+是代表有人进入,-代表有人出去)ri代表的是进入人的号码。 然后问你房间中最多同时有几个人存在。 思路: 我们需要两个变量max与sum,其中max是记录房间的最大容量的,sum是表示当前还有多

ACM_hades的梦想之路 812

Codeforces Round #Pi (Div. 2) (STL专场)

Codeforces Round #Pi (Div. 2) A - Lineland Mail 水题,拼手速。 /* * @author Novicer * language : C++/C */ #include<iostream> #include<sstream> #include<fstream> #include...

adr5970的博客 183

Codeforces Round #Pi (Div. 2) B. Berland National Library 模拟

B. Berland National LibraryTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/B Description Berland National Library has recently been built in the capital o...

weixin_30708329的博客 128

Codeforces Round #Pi (Div. 2) B Berland National Library

思路:对于这道题,一开始并没有什么思路,但后来想了下,其实就是维护一个集合,每一个人都是不同的元素,满足了集合的互异性,而要求这个图书馆最小的容纳量,其实就是求这个集合的最大的元素量,假设在某个时刻集合里存在M个元素,是集合从开始到结束出现过的元素个数的最大值,那么就是这个图书馆的最小容纳量,如果最小容纳量比M小,那怎么容得下M个人?对于+,   他之前肯定是没进或者之前出来股,无论怎样,都要加进

zyh 726

Codeforces Round #Pi (Div. 2) B. Berland National Library set

B. Berland National LibraryTime Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/567/problem/B Description Berland National Library has recently been built in the capital of...

weixin_30727835的博客 110

Codeforces Round #Pi (Div. 2)

题目传送:Codeforces Round #Pi (Div. 2)A. Lineland Mail水题。。AC代码:#include <map> #include <set> #include <cmath> #include <deque> #include <queue> #include <stack> #include <cstdio> #include <cctype> #include

Never say never 733

构造 Codeforces Round #Pi (Div. 2) B. Berland National Library

题目传送门 1 /* 2 题意:给出一系列读者出行的记录,+表示一个读者进入,-表示一个读者离开,可能之前已经有读者在图书馆 3 构造:now记录当前图书馆人数,sz记录最小的容量,in数组标记进去的读者,分情况讨论一下 4 */ 5 /************************************************ 6 * Aut...

weixin_34004750的博客 123

B. Berland National Library-水题- Codeforces Round #Pi (Div. 2)

http://codeforces.com/contest/567/problem/B 给n个数据 记录 图书馆进出的人 求   图书馆最小的容纳量 #include #include #include #include #include #include #include #include #include #include using namespace

缺氧 469

Codeforces Round #Pi (Div. 2)(A,B,C,D)

A题: 题目地址: Lineland Mail #include &lt;stdio.h&gt; #include &lt;math.h&gt; #include &lt;string.h&gt; #include &lt;stdlib.h&gt; #include &lt;iostream&gt; #include &lt;sstream&gt; #include &...

weixin_33881050的博客 107
上一篇: Codeforces Round #Pi (Div. 2)567A Lineland Mail(模拟)
下一篇: Codeforces Round #Pi (Div. 2)567C Geometric Progression(map暴力)
GKHack
博客等级 码龄11年 48粉丝 291原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值