#include<bits/stdc++.h>
using namespace std;
struct node{
int id, d_score, c_score;
};
int m;
vector<node>v1, v2, v3, v4; //才徳全尽,德胜才,才德兼亡, 其他
bool cmp(node x, node y){
if ((x.d_score+x.c_score) == (y.d_score+y.c_score)){
if (x.d_score != y.d_score){
return x.d_score > y.d_score;
}else{
return x.id < y.id;
}
}else{
return (x.d_score+x.c_score) > (y.d_score+y.c_score);
}
}
void vprint(vector<node> x){
for(int i = 0; i < x.size(); i++){
printf("%d %d %d\n", x[i].id, x[i].d_score, x[i].c_score);
// cout << x[i].id << x[i].d_score << x[i].c_score << endl;
}
return ;
}
int main(){
int n, l, h, a, b, c;
cin >> n >> l >> h;
for (int i = 0; i < n; i++){
cin >> a >> b >> c;
if (b >= l && c >= l){
m++;
if (b >= h && c >= h){
v1.push_back(node{a, b, c});
}else if (b >= h && c < h){
v2.push_back(node{a, b, c});
}else if (b < h && c < h && b >= c){
v3.push_back(node{a, b, c});
}else{
v4.push_back(node{a, b, c});
}
}
}
sort(v1.begin(), v1.end(), cmp);
sort(v2.begin(), v2.end(), cmp);
sort(v3.begin(), v3.end(), cmp);
sort(v4.begin(), v4.end(), cmp);
cout << m << endl;
vprint(v1);
vprint(v2);
vprint(v3);
vprint(v4);
return 0;
}
PAT/1015 德才论c++
于 2023-10-24 09:23:55 首次发布