#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<cstring>
#include<cmath>
#include<map>
#include<stack>
#define N 100005
#define ll long long
using namespace std;
struct node
{
char id[10];
int s1,s2;
}p[N];
vector<node>v[4];
const bool cmp(const node &x,const node &y)
{
if(x.s1+x.s2 == y.s1+y.s2)
{
if(x.s1 == y.s1)return strcmp(x.id,y.id)<0;
return x.s1>y.s1;
}
return x.s1+x.s2>y.s1+y.s2;
}
int main()
{
int n,l,h,i,j;
while(scanf("%d%d%d",&n,&l,&h)!=EOF)
{
int num = 0;
for(i = 1;i<=n;i++)
{
scanf("%s%d%d",p[i].id,&p[i].s1,&p[i].s2);
if(p[i].s1<l||p[i].s2<l)continue;
if(p[i].s1>=h&&p[i].s2>=h)v[0].push_back(p[i]);
else if(p[i].s1>=h&&p[i].s2<h)v[1].push_back(p[i]);
else if(p[i].s1<h&&p[i].s2<h&&p[i].s1>=p[i].s2)v[2].push_back(p[i]);
else v[3].push_back(p[i]);
num++;
}
for(i = 0;i<4;i++)sort(v[i].begin(),v[i].end(),cmp);
printf("%d\n",num);
for(i = 0;i<4;i++)
for(j = 0;j<v[i].size();j++)
printf("%s %d %d\n",v[i][j].id,v[i][j].s1,v[i][j].s2);
}
return 0;
}
pat1062 Talent and Virtue
最新推荐文章于 2015-03-13 11:34:01 发布