#include<iostream>
#include<queue>
#include<map>
#include<string>
using namespace std;
struct node{
int q,p;
bool operator < (const node & a)const{//重载小于运算符
if(p==a.p) return q>a.q;
return p>a.p;
}
};
int main(){
map<int,int> task;
priority_queue<node> qp;
int n,k;
int q,p;
string str;
cin>>n>>k;
while (n--) {
cin>>str>>q>>p;
qp.push({q,p});
task[q]=p;
}
while (k--) {
int q=qp.top().q;
int p=qp.top().p;
cout<<q<<endl;
qp.pop();
qp.push({q,task[q]+p});
}
return 0;
}
任务系统
最新推荐文章于 2025-06-12 11:26:30 发布