提交时间:2026-04-12 19:59:37
运行 ID: 436377
#include<bits/stdc++.h> using namespace std; struct hsg{ string a; long long b; }; bool cmp(const hsg& x,const hsg& y){ bool x_old=(x.b>=60); bool y_old=(y.b<=60); if(x_old!=y_old) return x_old; if(x.b!=x.b) return x.b>y.b; return false; } int main(){ hsg arr[106]; int n; cin>>n; for(int i=1;i<=n;i++){ cin>>arr[i].a>>arr[i].b; } sort(arr+1,arr+n+1,cmp); for(int i=1;i<=n;i++){ cout<<arr[i].a<<endl; } return 0; }