hdu5344MZL's simple problem stl set
2015-08-04 18:33
176 查看
// 1 x 在set中加x //2 删除集合中的最小元素 //3 输出集合的最大元素 #include<cstdio> #include<cstring> #include<iostream> #include<set> using namespace std ; const int maxn = 1e6+10 ; multiset<int> ms ; int main() { int n ; multiset<int>::iterator it ; while(~scanf("%d" , &n)) { ms.clear() ; while(n--) { int op , x ; scanf("%d" , &op) ; if(op == 1) { scanf("%d" , &x) ; ms.insert(x) ; } else if(op == 2) { if(!ms.size())continue ; ms.erase(ms.begin()) ; } else { if(!ms.size())puts("0") ; else { it = ms.end() ; it-- ; printf("%d\n" , *(it)) ; } } } } }
相关文章推荐
- fsocket发送post实现异步请求
- ceph存储 strace命令用法详解
- web.xml 指定配置路径
- 直到开始找工作才发现自己基础多差。现在追赶还来得及!开始行动吧!
- strlen函数实现的两种方法
- Activity Lifecycle
- Android之Adapter总结
- 【转】终极 Web 应用性能和压力测试工具 Gor
- Codeforces gym 100685 C. Cinderella 水题
- Linq List<T>.Distinct() 去除对象重复
- 【LIS】【严格递增和非严格递增】
- ubuntu命令
- 正则表达式验证日期
- android检查版本更新实现思路
- git Bash 安装&配置与基本操作
- git Bash 安装&配置与基本操作
- Bootstrap的js插件之滚动监听(scrollspy)
- avl树的插入(含单旋转,双旋转)
- C# string Spilt
- 在meteor中使用支付,以及与服务器进行数据交互