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