Codeforces 420 B. Online Meeting
来源:互联网 发布:淘宝上官换机是真的吗 编辑:程序博客网 时间:2024/06/06 06:32
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#include <set>using namespace std;const int maxn=110000;set<int> chat,st;bool vis[maxn];int id[maxn];char op[maxn];int main(){ int n,m; scanf("%d%d",&n,&m); for(int i=0;i<m;i++) { getchar(); scanf("%c%d",op+i,id+i); } for(int i=0;i<m;i++) { if(op[i]=='-') { if(vis[id[i]]==false) chat.insert(id[i]); } vis[id[i]]=true; } memset(vis,0,sizeof(vis)); for(int i=0;i<m;i++) { if(op[i]=='+') { if(chat.size()>0) vis[id[i]]=true; else st.insert(id[i]); chat.insert(id[i]); } else if(op[i]=='-') { if(chat.size()>1) vis[id[i]]=true; else st.insert(id[i]); chat.erase(id[i]); } } if(st.size()>1) { set<int>::iterator it; for(it=st.begin();it!=st.end();it++) { vis[*it]=true; } } int cnt=0; for(int i=1;i<=n;i++) if(vis[i]) cnt++; printf("%d\n",n-cnt); for(int i=1;i<=n;i++) if(!vis[i]) printf("%d ",i); putchar(10); return 0;}
1 0
- Codeforces 420 B. Online Meeting
- codeforces 420B Online Meeting
- CodeForces 420B Online Meeting
- Online Meeting - CodeForces 420B 水题
- codeforces 402 B Online Meeting
- CF - 420B - Online Meeting(思维)
- 【CODEFORCES】 B. Chat Online
- Codeforces Round #433 B. Jury Meeting
- CodeForces 469B Chat Online
- CodeForces 469B Chat Online
- Codeforces 469B Chat Online
- Meeting --- Codeforces
- B. Meeting
- 【codeforces 782B】The Meeting Place Cannot Be Changed
- codeforces 782B The Meeting Place Cannot Be Changed
- Codeforces 780B-The Meeting Place Cannot Be Changed
- 【Codeforces 782 B The Meeting Place Cannot Be Changed】+ 二分
- codeforces B. The Meeting Place Cannot Be Changed【二分】
- MySQL 4.1/5.0/5.1/5.5/5.6各版本的主要区别
- 无限级目录树最优算法的新研究
- 第7周作业1——背包问题
- Uva-10131 Is Bigger Smarter?
- 使用xmlhttp为网站增加股市行情查询功能
- Codeforces 420 B. Online Meeting
- ExtJs4 Ext.tab.Panel 选项卡
- FFMPEG视音频编解码零基础学习方法
- IE里的探索之添加浏览器栏
- 防止应用程序被反编译的译源码混淆控件Dotfuscator
- ASP中SQL语句导致的性能问题
- [整合]FreeMarker使用方法讲解
- [Between] python calls java
- PostgreSQL 集群/热备方案