老是交错语言..
比扔石头还简单一点的优先队列
#include<cstdio>
#include<queue>
using namespace std;
struct node
{
int id;
int po;
int le;
bool operator<(const node &a) const
{
if (po==a.po) return id>a.id;
else return po>a.po;
}
};
int main()
{
int k,i;
char s[20];
struct node a;
priority_queue<node>q;
while (scanf("%s",s)&&s[0]!='#')
{
scanf("%d%d",&a.id,&a.le);
a.po=a.le;
q.push(a);
}
scanf("%d",&k);
while (k--)
{
a=q.top();
q.pop();
printf("%d\n",a.id);
a.po+=a.le;
q.push(a);
}
}