#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
struct student{
char id[10];
int vir,tal,level;
int sum;
}stu[100010];//这里一定要注意,按照题干的要求,否则出现段错误。很难找。。
bool cmp(student a,student b)
{
if(a.level!=b.level) return a.level>b.level;
else if(a.sum!=b.sum) return a.sum>b.sum;
else if(a.vir!=b.vir ) return a.vir>b.vir;
else return strcmp(a.id,b.id)<0;
}
int main(){
int n,m,i,l,h;
scanf("%d%d%d",&n,&l,&h);
m=n;
for(i=0;i<n;i++)
{
scanf("%s%d%d",stu[i].id,&stu[i].vir,&stu[i].tal);
stu[i].sum=stu[i].vir+stu[i].tal;
if(stu[i].vir<l||stu[i].tal<l)
{
stu[i].level=1;
m--;
}
else if(stu[i].vir>=h&&stu[i].tal>=h) stu[i].level=5;
else if(stu[i].vir>=h&&stu[i].tal<h) stu[i].level=4;
else if(stu[i].vir>=stu[i].tal) stu[i].level=3;
else stu[i].level=2;
}
sort(stu,stu+n,cmp);
printf("%d\n",m);
for(i=0;i<m;i++)
{
printf("%s %d %d\n",stu[i].id,stu[i].vir,stu[i].tal) ;
}
return 0;
}
Sample Input:
14 60 80
10000001 64 90
10000002 90 60
10000011 85 80
10000003 85 80
10000004 80 85
10000005 82 77
10000006 83 76
10000007 90 78
10000008 75 79
10000009 59 90
10000010 88 45
10000012 80 100
10000013 90 99
10000014 66 60
Sample Output:
12
10000013 90 99
10000012 80 100
10000003 85 80
10000011 85 80
10000004 80 85
10000007 90 78
10000006 83 76
10000005 82 77
10000002 90 60
10000014 66 60
10000008 75 79
10000001 64 90