题意:1表示插入客户K,他的优先级是P(相当于大小),2表示输出当前优先级最高的客户(即找出最大值),并且删除。3同理输出最低级的。

这题可以用splay treap AVL SBT …… (可是我并不会)

这里set水过。。

#include <set>
#include <cstdio>
using namespace std;
set<pair<int,int> >s;
set<pair<int,int> >::iterator it;
int main(){
int p,xx,yy;
while(scanf("%d",&p)&&p){
if(p==1){scanf("%d%d",&xx,&yy),s.insert(make_pair(yy,xx));continue;}
else if(s.empty()){puts("0");continue;}
else if(p==3) it=s.begin();
else it=--s.end();
printf("%d\n",(*it).second),s.erase(it);
}
}

POJ 3481 set水过的更多相关文章

  1. POJ 3481 Double Queue STLmap和set新学到的一点用法

    2013-08-08 POJ 3481  Double Queue 这个题应该是STL里较简单的吧,用平衡二叉树也可以做,但是自己掌握不够- -,开始想用两个优先队列,一个从大到小,一个从小到大,可是 ...

  2. 【转】POJ百道水题列表

    以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...

  3. POJ.1003 Hangover ( 水 )

    POJ.1003 Hangover ( 水 ) 代码总览 #include <cstdio> #include <cstring> #include <algorithm ...

  4. POJ.1552 Doubles(水)

    POJ.1552 Doubles(水) 题意分析 暴力 代码总览 #include <cstdio> #include <stdio.h> #define nmax 100 u ...

  5. POJ 3481 Double Queue(Treap模板题)

    Double Queue Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 15786   Accepted: 6998 Des ...

  6. POJ 3481 &amp; HDU 1908 Double Queue (map运用)

    题目链接: PKU:http://poj.org/problem?id=3481 HDU:http://acm.hdu.edu.cn/showproblem.php?pid=1908 Descript ...

  7. POJ 3050 Hopscotch 水~

    http://poj.org/problem?id=3050 题目大意: 在一个5*5的格子中走,每一个格子有个数值,每次能够往上下左右走一格,问走了5次后得到的6个数的序列一共同拥有多少种?(一開始 ...

  8. poj 3264 RMQ 水题

    题意:找到一段数字里最大值和最小值的差 水题 #include<cstdio> #include<iostream> #include<algorithm> #in ...

  9. POJ 1836 Alignment 水DP

    题目: http://poj.org/problem?id=1836 没读懂题,以为身高不能有相同的,没想到排中间的两个身高是可以相同的.. #include <stdio.h> #inc ...

随机推荐

  1. picturebox中添加图片

    private void Form1_Load(object sender, EventArgs e) { radioButton2.Checked = true; } private void ra ...

  2. Django - 创建多对多及增加示例

    创建多对多: 方式一: 自定义关系表 备注:自定义表Host.Application,通过自定义表,将表Host和Application进行关联(通过外键方式工): 执行语句:python manag ...

  3. 51nod1049 最大子段和【动态规划】

    N个整数组成的序列a[1],a[2],a[3],-,a[n],求该序列如a[i]+a[i+1]+-+a[j]的连续子段和的最大值.当所给的整数均为负数时和为0. 例如:-2,11,-4,13,-5,- ...

  4. 水图(牛客练习赛(DFS搜索))

    题意: 小w不会离散数学,所以她van的图论游戏是送分的 小w有一张n个点n-1条边的无向联通图,每个点编号为1~n,每条边都有一个长度小w现在在点x上她想知道从点x出发经过每个点至少一次,最少需要走 ...

  5. pyhon中的内存优化机制

    一.变量的内存地址 python中变量的内存地址可以用id()来查看 >>> a = " >>> id(a) 2502558915696 二.pyhon中 ...

  6. Matplotlib基本使用简介

    目录 Matplotlib基本使用简介 1. Matplotlib简介 2. Matplotlib操作简介 Matplotlib基本使用简介 1. Matplotlib简介   Matplotlib是 ...

  7. Git 基础教程 之 别名

     配置别名, 例如:       git config --global alias.st status                                      git config ...

  8. jdk8--十大新特性

    https://www.cnblogs.com/dennyzhangdd/p/6722445.html 一.十大特性 1.Lambda表达式 2.Stream函数式操作流元素集合 3.接口新增:默认方 ...

  9. java 常见问题

    1.Cannot convert value '0000-00-00 00:00:00' from column 1 to TIMESTAMP 2.怎么解决BigDecimal里面无限循环小数的问题啊 ...

  10. BZOJ 4032 Luogu P4112 [HEOI2015]最短不公共子串 (DP、后缀自动机)

    这其实是道水题... 题目链接: (bzoj)https://www.lydsy.com/JudgeOnline/problem.php?id=4032 (luogu)https://www.luog ...