#include<stdio.h>
#include<algorithm>
using namespace std;
struct node{
int id, de, cai, sum, Rank;
}temp, Node[100010];
bool cmp(node a, node b){
if(a.Rank != b.Rank) return a.Rank < b.Rank;
else if(a.sum != b.sum) return a.sum > b.sum;
else if(a.de != b.de) return a.de > b.de;
else return a.id < b.id;
}
int main(){
int n, l, h, cnt = 0, cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
scanf("%d %d %d", &n, &l, &h);
while(n--){
scanf("%d %d %d", &temp.id, &temp.de, &temp.cai);
temp.sum = temp.cai + temp.de;
if(temp.cai >= h && temp.de >= h)
temp.Rank = 1;
else if(temp.de >= h && temp.cai < h && temp.cai >= l)
temp.Rank = 2;
else if(temp.de >= l && temp.de < h && temp.cai >= l && temp.cai < h && temp.de >= temp.cai)
temp.Rank = 3;
else if(temp.de >= l && temp.cai >= l)
temp.Rank = 4;
if(temp.de >= l && temp.cai >= l) Node[cnt++] = temp;
}
printf("%d\n", cnt);
sort(Node, Node + cnt, cmp);
for(int i = 0; i < cnt; i ++){
printf("%d %d %d\n", Node[i].id, Node[i].de, Node[i].cai);
}
return 0;
}
1015 德才论 (25分)
最新推荐文章于 2022-01-29 12:12:10 发布