彭科壹 @ 2021-08-29 20:38:29
#include<bits/stdc++.h>
using namespace std;
int main(){
int q,w[305][5],zongchengji[305],yuwenchengji[305],xuehao[305];
cin>>q;
int ans=0;
for(int i=1;i<=q;i++){
cin>>w[i][1]>>w[i][2]>>w[i][3];
ans++;
zongchengji[ans]=w[i][1]+w[i][2]+w[i][3];
yuwenchengji[ans]=w[i][1];
xuehao[ans]=i;
}
int a=0,b=0;//yuwen
int m=0;//xuehao
for(int j=1;j<=5;j++){
for(int i=1;i<=q;i++)
{
if(i==1) continue;
if(a<zongchengji[i]){
a=zongchengji[i];
b=w[i][1];
m=i;
continue;
}
if(zongchengji[i]==a){
if(w[i][1]>m){
a=zongchengji[i];
b=w[i][1];
m=i;
continue;
}
else{
continue;
}
}
cout<<m<<" "<<a<<endl;
w[m][1]=0;
w[m][2]=0;
w[m][3]=0;
}
}
return 0;
}