提交时间:2025-05-10 13:40:29
运行 ID: 321404
#include<bits/stdc++.h> using namespace std; struct hsb{ string id; long long age; int xi; }a[120]; bool cmp(hsb x,hsb y){ if(x.age>=60&&y.age>=60){ if(x.age!=y.age) return x.age>y.age; return x.xi<y.xi; } if(x.age<60&&y.age<60) return x.xi<y.xi; 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].xi=i; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++){ cout<<a[i].id<<endl; } return 0; }