题目链接:传送门(点我)
#include<bits/stdc++.h>
using namespace std;
typedef struct{
int se;//serial
int ch;//china
int all;//sum number
}node;
node a[500];
int n,b,c;
bool cmp(const node &a,const node &b){
if(a.all==b.all){
if(a.ch==b.ch)return a.se<b.se;
else return a.ch>b.ch;
}
return a.all>b.all;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i].ch>>b>>c;
a[i].all=a[i].ch+b+c;
a[i].se=i;
}
sort(a+1,a+1+n,cmp);
for(int i=1;i<=5;i++)cout<<a[i].se<<" "<<a[i].all<<endl;
return 0;
}