Start: Jul, 10, 2019 08:30:00
2019年度暑期短学期达标测试补考
End: Jul, 10, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: H
Result: Accepted
Time: 5ms
Memory: 2020kB
Author: 2018212212289
In contest: 1284

#include<bits/stdc++.h>
using namespace std;
struct student{
	char name[30];
	int gg;
};
bool cmp(const student& n1,const student &n2){
	return n1.gg>n2.gg;
}
int main()
{
  struct student array[110];
  int sum,n;
  scanf("%d",&sum);
  while(sum--){
  	scanf("%d",&n);
	for(int i=0;i<n;++i){
  	    scanf("%s%d",array[i].name,&array[i].gg);
    }
	sort(array,array+n,cmp);
	for(int i=0;i<n;++i){
  	    printf("%s\n",array[i].name);
    }
  }
}