#include<queue>
#include<cstdio>
using namespace std;
struct node
{
int id,vir,tal,sum;
node(int a,int b,int c):id(a),vir(b),tal(c),sum(b+c){}
bool operator<(const node&x)const
{
if(sum!=x.sum)return sum<x.sum;
if(vir!=x.vir)return vir<x.vir;
return id>x.id;
}
};
priority_queue<node>que[4];
int n,H,L;
int main()
{
scanf("%d%d%d",&n,&L,&H);
for(int a,b,c,i=0;i<n;++i)
{
scanf("%d%d%d",&a,&b,&c);
if(b<L||c<L)continue;
if(b>=H)
{
if(c>=H) que[0].push(node(a,b,c));
else que[1].push(node(a,b,c));
}else{
if(b>=c) que[2].push(node(a,b,c));
else que[3].push(node(a,b,c));
}
}
printf("%d\n",que[0].size()+que[1].size()+que[2].size()+que[3].size());
for(int i=0;i<4;++i)
while(que[i].size())
{
node x=que[i].top();
que[i].pop();
printf("%d %d %d\n",x.id,x.vir,x.tal);
}
return 0;
}
无聊的模拟题
09-09