提示:不要管我做了什么题,不要看我的做题记录。
#include <bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL);
typedef long long ll;
typedef size_t ull;
const int inf = 0x3f3f3f3f;
const int homo = 114514;
using namespace std;
int n;
struct Node{
int chi, mth, eng, id, sum;
}a[305];
void init(){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i].chi >> a[i].mth >> a[i].eng;
a[i].id = i;
a[i].sum = a[i].chi + a[i].mth + a[i].eng;
}
}
bool cmp(Node x, Node y){
if(x.sum != y.sum) return x.sum > y.sum;
if(x.chi != y.chi) return x.id < y.id;
return x.chi < y.chi;
}
void work(){
sort(a + 1, a + n + 1, cmp);
}
void ouit(){
for(int i = 1; i <= 5; i++){
cout << a[i].id << " " << a[i].sum << endl;
}
}
signed main(){
init();
work();
ouit();
return 0;
}