HDU 1873 看病要排队
来源:互联网 发布:sql去除重复字段 编辑:程序博客网 时间:2024/05/16 03:12
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1873
中文题。
最最最裸的优先队列题了。不想多说什么了。
#include<cstdio>#include<cstring>#include<cmath>#include<cstdlib>#include<iostream>#include<algorithm>#include<sstream>#include<vector>#include<map>#include<stack>#include<list>#include<set>#include<queue>#define LL long long#define lson l,m,rt<<1#define rson m+1,r,rt<<1 | 1using namespace std;const int maxn=1005,maxe=100005,inf=1<<29;int n,m;struct node{ int v,id; friend bool operator < (node a,node b) { if(a.v!=b.v) return a.v<b.v; return a.id>b.id; }};int main(){ string op; int a,b; while(cin>>n) { priority_queue<node>q[4]; int cnt=1; while(n--) { cin>>op; if(op=="IN") { cin>>a>>b; node t={b,cnt++}; q[a].push(t); } else { cin>>a; if(q[a].size()==0) cout<<"EMPTY"<<endl; else cout<<q[a].top().id<<endl,q[a].pop(); } } } return 0;}
0 0
- hdu 1873 看病要排队
- hdu 1873 看病要排队
- hdu 1873(看病要排队)
- HDU 1873 看病要排队
- hdu 1873 看病要排队
- HDU 1873 看病要排队
- HDU 1873看病要排队
- hdu 1873 看病要排队
- HDU 1873 看病要排队
- HDU-1873-看病要排队
- HDU 1873 看病要排队
- HDU 1873 看病要排队
- hdu 1873 看病要排队
- HDU 1873 看病要排队
- hdu 1873 看病要排队
- HDU 1873 看病要排队
- hdu 1873 看病要排队
- HDU 1873 看病要排队
- RTSP协议介绍
- 分享成功后返回出现两个默认应用
- 高质量单幅图片运动去模糊
- squid 2.7(源码) 安装 步骤
- Android的onCreateOptionsMenu()创建菜单Menu详解
- HDU 1873 看病要排队
- 遍历Map的四种方法
- zoj 1560 Hansel and Grethel(求两条直线的交点)
- nodejs 自动回复
- JAVA配置登录过滤器和编码过滤器
- iOS开发- UICollectionView详解+实例
- Stanford机器学习---第二讲. 多变量线性回归 Linear Regression with multiple variable
- 以自定义方式加载 lua 模块
- 手机App的商业模式有哪些