2015 多校联赛 ——HDU5349(水)
Problem Description
You have a multiple set,and now there are three kinds of operations:
1 x : add number x to set
2 : delete the minimum number (if the set is empty now,then ignore it)
3 : query the maximum number (if the set is empty now,the answer is 0)
the number of operations.
Next N line
,each line contains one or two numbers,describe one operation.
The number in this set is not greater than 109.
1 2
1 3
3
1 3
1 4
3
4
三个操作,删除最小,查询最大,插入
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<cmath>
#include<queue>
typedef long long ll;
using namespace std; int main()
{
int n;
while(scanf("%d",&n)==1)
{
int x;
ll q, tmax = -1000000100;
int sum = 0;
for(int i = 1; i <= n; i++)
{
scanf("%d",&x);
if(sum==0)
tmax = -1000000100;
if(x == 1)
{
scanf("%I64d",&q);
if(q >= tmax)
tmax = q;
sum++;
}
if(x == 2)
{
if(sum>0)
sum--;
}
if(x == 3)
{
if(sum>0)
printf("%I64d\n",tmax);
else printf("0\n");
}
}
} return 0;
}
2015 多校联赛 ——HDU5349(水)的更多相关文章
- 2015 多校联赛 ——HDU5400(水)
Sample Input 5 2 -2 0 2 0 -2 0 5 2 3 2 3 3 3 3 Sample Output 12 5 求最多多少序列满足,前半部分满足d(j+1) = d(j)+d1 ...
- 2015 多校联赛 ——HDU5344(水)
Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to ...
- 2015 多校联赛 ——HDU5334(构造)
Virtual Participation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Ot ...
- 2015 多校联赛 ——HDU5302(构造)
Connect the Graph Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others ...
- 2015 多校联赛 ——HDU5294(最短路,最小切割)
Tricks Device Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) To ...
- 2015 多校联赛 ——HDU5325(DFS)
Crazy Bobo Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others) Tota ...
- 2015 多校联赛 ——HDU5316(线段树)
Fantasy magicians usually gain their ability through one of three usual methods: possessing it as an ...
- 2015 多校联赛 ——HDU5323(搜索)
Solve this interesting problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- 2015 多校联赛 ——HDU5319(模拟)
Painter Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Su ...
随机推荐
- python 归并排序
def merge_sort(alist): if len(alist) <= 1: return alist # 二分分解 num = len(alist)/2 left = merge_so ...
- github感悟
刚学GitHub进入网页全英文的,感觉很惊讶,自己竟然要在全英文的网站上学习,虽然是英文的但并不感觉有压力,可能之前用eclipse就是全英文的现在除了惊讶,没太多的想法.然后就是我的GitHub地址 ...
- Python入门代码练习
一.循环猜年龄程序,猜错三次则打印提示信息并退出循环,猜对也打印提示信息并退出循环 count=0while count < 3: num = input("猜年龄游戏:") ...
- PV & PVC - 每天5分钟玩转 Docker 容器技术(150)
Volume 提供了非常好的数据持久化方案,不过在可管理性上还有不足. 拿前面 AWS EBS 的例子来说,要使用 Volume,Pod 必须事先知道如下信息: 当前 Volume 来自 AWS EB ...
- css的内容
块级元素和行内元素的区别: 1. 行内元素部不能够设置宽度和高度.行内元素的宽度和高度是标签内容的宽度和高度.块级元素可以设置宽度和高度. 2. 块级元素会独占一行.而行内元素却部能够独占一行,只能和 ...
- 2-51单片机WIFI学习(开发板测试远程通信详细介绍)
前一篇链接(最后有APP安装包下载地址) http://www.cnblogs.com/yangfengwu/p/8720148.html 由于自己别的贴片的板子还没到,所以用自己的8266最小系统板 ...
- Python内置函数(17)——chr
英文文档: chr(i) Return the string representing a character whose Unicode code point is the integer i. F ...
- ASP.NET Web API编程——模型验证与绑定
1.模型验证 使用特性约束模型属性 可以使用System.ComponentModel.DataAnnotations提供的特性来限制模型. 例如,Required特性表示字段值不能为空,Range特 ...
- JavaScript 原型中的哲学思想
学习JavaScript过程中,原型问题一直让我疑惑许久,那时候捧着那本著名的红皮书,看到有关原型的讲解时,总是心存疑虑.当在JavaScript世界中走过不少旅程之后,再次萌发起研究这部分知识的欲望 ...
- Spring知识点回顾(07)事件发布和监听
Spring知识点回顾(07)事件发布和监听 1.DemoEvent extends ApplicationEvent { public DemoEvent(Object source, String ...