Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
382 | 邓小龙 | 病人排队 | C++ | Accepted | 1 MS | 264 KB | 896 | 2022-08-13 15:38:08 |
#include<iostream> #include<cstring> #include<algorithm> using namespace std; struct peo { string num; int year; }; bool cmp_old(peo x,peo y) { if(x.year!=y.year) return x.year>y.year; else return x.num<y.num; } bool cmp_young(peo x,peo y) { return x.num<y.num; } int main() { int n,l=0,j=0; cin>>n; struct peo a[n],b[n]; for(int i=0;i<n;i++) { cin>>a[l].num>>a[l].year; if(a[l].year>=60) { b[j].year=a[l].year; b[j].num=a[l].num; l--; j++; } l++; } sort(b,b+j,cmp_old); sort(a,a+l,cmp_young); for(int i=0;i<j;i++) { cout<<b[i].num<<endl;//<<" "<<b[i].year<<endl; } for(int i=0;i<l;i++) { cout<<a[i].num<<endl;//<<" "<<a[i].year<<endl; } return 0; }