题目链接:http://codeforces.com/gym/100712/attachments
大水题一个,直接排序就好了。
附上AC代码:
#include <bits/stdc++.h>
//#pragma comment(linker, "/STACK:102400000, 102400000")
using namespace std;
const int maxn = 105;
const int maxlen = 25;
struct node{
char name[maxlen];
int s, time;
bool operator < (const node & p) const {
if (s == p.s)
return time < p.time;
return s > p.s;
}
} t[maxn];
int n;
int main(){
#ifdef LOCAL
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int T;
scanf("%d", &T);
while (T--){
scanf("%d", &n);
for (int i=0; i<n; ++i)
scanf("%s%d%d", &t[i].name, &t[i].s, &t[i].time);
sort(t, t+n);
printf("%s\n", t[0].name);
}
return 0;
}