B. Berland National Library
来源:互联网 发布:网络电影播放器排行榜 编辑:程序博客网 时间:2024/05/17 09:25
解题说明:此题其实是一道堆栈题,判断堆栈中元素最多的情况。
#include<stdio.h>#include <string.h>#include<iostream>#include<algorithm>using namespace std;int main(){int n,a[1000002]={0},i,b[1000002]={0},max=0,d=0,x;char c;scanf("%d",&n);while(n--){scanf("\n%c %d",&c,&x);if(b[x]==0 && c=='-'){max++;}else if(c=='-'){a[x]=0;d--;}else if(c=='+'){b[x]=1;d++;if(d>max){max=d;}}}printf("%d\n",max);return 0;}
0 0
- B. Berland National Library
- Codeforces B - Berland National Library
- Codeforces 567B Berland National Library
- Codeforces 567 B. Berland National Library
- Code Forces 567B Berland National Library
- CodeForces 567B Berland National Library
- CodeForces 567B Berland National Library
- CodeForces 567B Berland National Library
- CodeForces - 567B Berland National Library
- CodeForces-567B Berland National Library
- CodeForces 567B-Berland National Library
- CodeForces 567B Berland National Library
- CF 567B Berland National Library
- Berland National Library CodeForces - 567B
- CodeForces 567B Berland National Library【思维】
- CF 567B Berland National Library
- Berland National Library
- Berland National Library
- 提取最长转录本的代码
- 一步一步在ubuntu上安装即时通讯服务器-Openfire
- poj 2387 Til the Cows Come Home
- 重复子串问题(五):求最长回文字符子串
- 动态规划专题之zoj1013
- B. Berland National Library
- 浅析CVE-2015-3636
- Ubuntu 安装mysql和简单操作
- CS224d Problem set 2作业
- 如何实时查看linux下的日志
- uva 673 Parentheses Balance
- 1078. Hashing (25)
- The Roatin Games poj
- 一笔画问题 NYOJ