Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
367897 余逸凡 【C5-9】病人排队 C++ 通过 100 10 MS 256 KB 464 2025-12-13 07:58:25

Tests(10/10):


#include<bits/stdc++.h> using namespace std; struct b{ string s; int age,id; }a[105]; bool cmp(b x,b y){ if(x.age>=60&&y.age>=60){ if(x.age!=y.age) return x.age>y.age; return x.id<y.id; } if(x.age<60&&y.age<60)return x.id<y.id; return x.age>y.age; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].s>>a[i].age; a[i].id=i; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++){ cout<<a[i].s<<endl; } return 0; }


测评信息: