AcWing 429. 奖学金
原题链接
简单
作者:
偷月亮的喵
,
2024-12-23 10:07:22
,
所有人可见
,
阅读 1
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int sum;
typedef pair<int, int> PII;
typedef pair<PII, int> P;
#define x1 first
#define y1 second
P q[305];
bool cmp(P x, P y){
if(x.x1.x1 != y.x1.x1){
return x.x1.x1 > y.x1.x1;
}else if(x.x1.y1 != y.x1.y1){
return x.x1.y1 > y.x1.y1;
}else if(x.y1 != y.y1)
return x.y1 < y.y1;
}
int main()
{
int n;
cin >>n;
for (int i = 1; i <= n; i ++ ){
int x, y, z;
cin >> x >> y >> z;
q[i].x1.x1 = x + y + z;
q[i].x1.y1 = x;
q[i].y1 = i;
}
sort(q + 1, q + n + 1, cmp);
for (int i = 1; i <= 5; i ++ ){
cout << q[i].y1 << ' ' << q[i].x1.x1 << '\n';
}
return 0;
}