奖学金
奖学金
#include<bits/stdc++.h>
using namespace std;
struct node
{
int Y;
int S;
int E;
int sm;
int k;
};
bool cmp(struct node a,struct node b)
{
if(a.sm>b.sm) return true;
else if(a.sm==b.sm)
{
if(a.Y>b.Y) return true;
else if(a.Y==b.Y)
{
return a.k<b.k;
}
else return false;
}
else return false;
}
int main()
{
node s[301];
int n;
cin>>n;
for(int i=1; i<=n; i++)
{
cin>>s[i].Y>>s[i].S>>s[i].E;
s[i].sm=s[i].Y+s[i].S+s[i].E;
s[i].k=i;
}
sort(s+1,s+1+n,cmp);
for(int i=1; i<=5; i++)
cout<<s[i].k<<" "<<s[i].sm<<endl;
}