Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
321432 | 毛泽锡 | 【C5-9】病人排队 | C++ | 解答错误 | 0 | 6 MS | 348 KB | 508 | 2025-05-10 13:53:50 |
#include<bits/stdc++.h> using namespace std; struct sgh{ string id; int age,t; }a[2025]; bool cmp(sgh x,sgh y){ if(x.age>=60&&y.age>=60){ if(x.age!=y.age){ return x.age>y.age; } return x.t<y.t; } if(x.age<60&&y.age<60){ return x.t<y.t; return x.age>y.age; } } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].id>>a[i].age; a[i].t=i; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++){ cout<<a[i].id<<endl; } return 0; }