#include<bits/stdc++.h>

using namespace std;

struct person{

string id;

int age;

int orderid;

}a[305];

int n;

bool cmp(person x,person y){

if(x.age>=60&&y.age>=60) 

return (x.age>y.age)|| (x.age==y.age&&x.orderid<y.orderid);

else if(x.age<60&&y.age<60) 

return x.orderid<y.orderid;

	else   return x.age>y.age;

} int main(){

cin>>n;

for(int i=1;i<=n;i++){

cin>>a[i].id>>a[i].age;

a[i].orderid=i;

} sort(a+1,a+1+n,cmp);

for(int i=1;i<=n;i++)

cout<<a[i].id<<endl;

return 0;

}

1 条评论

  • 1

信息

ID
185
时间
ms
内存
MiB
难度
2
标签
递交数
1015
已通过
250
上传者