#include <cstdio>
#include <cstdlib>
#include <string>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cctype>
using namespace std;
typedef struct{
int id, v, t, kind;
}Stu;
bool cmp(Stu s1, Stu s2){
if(s1.kind != s2.kind) return s1.kind < s2.kind;
else if((s1.v+s1.t) != (s2.v+s2.t))return (s1.v+s1.t) > (s2.v+s2.t);
else if(s1.v != s2.v) return s1.v > s2.v;
else return s1.id < s2.id;
}
int L, H;
int classify(int v, int t){
if(v >= H && t >= H) return 0;
else if(v >= H && t < H) return 1;
else if(v < H && v >= t) return 3;
else return 4;
}
int main(){
Stu stu[100010];
int n, m = 0;
int no, vg, tg;
scanf("%d %d %d", &n, &L, &H);
for(int i = 0; i < n; i++){
scanf("%d %d %d", &no, &vg, &tg);
if(vg >= L && tg >= L){
stu[m].id = no; stu[m].v = vg;
stu[m].t = tg; stu[m].kind = classify(vg, tg);
++m;
}
}
sort(stu, stu+m, cmp);
printf("%d\n", m);
for(int i = 0; i < m; i++){
printf("%d %d %d\n", stu[i].id, stu[i].v, stu[i].t);
}
return 0;
}
A1062 Talent and Virtue (25 分)
最新推荐文章于 2021-03-02 12:27:27 发布