The tough time <set>
来源:互联网 发布:java教程书籍推荐 编辑:程序博客网 时间:2024/06/06 17:45
题意:
公司每年要解除value最小的女工,然后再照进来一位,当value 同时最小时,开除 标号比较大的那位。
已知N : a[i] 代表 i 号女工的vaue, M:b[i]: 第i年招进来的员工的value
输出 每年开除的员工的标号,以及当前她的value
#include<stdio.h>#include<string.h>#include<math.h>#include<string>#include<iostream>#include<set>#include<algorithm>using namespace std;struct node{ int id; int x; node(int id,int x):id(id),x(x){}; friend bool operator < (const node a,const node b) { if(a.x==b.x) return a.id>b.id; else return a.x<b.x; }};set<node>cur;int main(){ // freopen("in.in","r",stdin); int T; scanf("%d",&T); while(T--) { int n,m; scanf("%d%d",&n,&m); cur.clear(); int tp; for(int i=1;i<=n;i++) { scanf("%d",&tp); cur.insert(node(i,tp)); } for(int i=0;i<m;i++) { node top=*cur.begin(); cur.erase(cur.begin()); printf("%d %d\n",top.id,top.x-i); scanf("%d",&tp); cur.insert(node(i+n+1,tp+i+1)); } } return 0;}
0 0
- The tough time <set>
- The time
- Tough Days
- java set system time
- NBUT 1561 Set Time
- [noj 1561] Set Time
- about Set Session Time Zone
- mybatis set session time zone
- Set statistics time 输出 CPU time> elapsed time
- For the first time!
- The Time for sprint
- The time is now!!
- Escaping the Time Trap
- the first time
- the time bank
- The passage of time
- Spring, the Resurrection Time
- The first time using
- 关于查找tr不在table中的问题
- 学习Ajax框架之dojo:第十三节——如何编写自己的dojo widget
- android自带的base64编码
- 在Android4.0中Contacts通话记录界面剖析(源码)
- Palantir:大数据的抽象程度需要进一步提高
- The tough time <set>
- 最美的十大经典爱情句子
- git使用说明
- Qt提示QPainter::begin: Paint device returned engine == 0, type:0/1/2/3...,type数值代表什么
- 拉格朗日对偶性和似然函数
- H264和X264究竟有什么区别?
- launching真正全屏去状态栏
- OCM_Session8_3_Role Transitions Involving Physical Standby Databases
- NSTimer 定时器 IOS