#include<bits/stdc++.h>
#define N 10001
using namespace std;
struct stu{
int id,c,m,e,s;
}a[N];
bool cmp(stu x,stu y){
if(x.s!=y.s) return x.s>y.s;
if(x.s==y.s && x.c!=y.c) return x.c>y.c;
if(x.s==y.s && x.c==y.c && x.id != y.id ) return x.id < y.id;
}
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
a[i].id=i+1;
cin>>a[i].c>>a[i].m>>a[i].e;
a[i].s=a[i].c+a[i].m+a[i].e;
}
//a数组排序
sort(a,a+n,cmp);
for(int i=0;i<5;i++){
cout<<a[i].id<<" "<<a[i].s<<endl;
}
return 0;
}
评论区