提交时间:2025-05-10 13:41:33
运行 ID: 321409
#include<bits/stdc++.h> using namespace std; struct pe{ int h; string s; int t; }a[110]; bool cmp(pe x,pe y){ if(x.h>=60&&y.h>=60){ if(x.h!=y.h) return x.h>y.h; return x.t<y.t; } if(x.h<60&&y.h<60){ return x.t<y.t; } } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].s>>a[i].h; a[i].t=i; } sort(a+1,a+n+1,cmp) ; for(int i=1;i<=n;i++){ cout<<a[i].s<<endl; } return 0; }