Start: Jul, 05, 2019 08:40:00
2019年度暑期短学期达标测试
End: Jul, 05, 2019 11:40:00
Time elapsed:
Time remaining:

Problem_ID: K
Result: Accepted
Time: 104ms
Memory: 3716kB
Author: CT12811941281
In contest: 1281

#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<map>
#include<math.h>
#include<map>
#include<string>
using namespace std;
const int maxn=100020;
const int inf=0x3f3f3f;
struct stu{
	int id;
	int zs;
	int yz;
	int fl;
	int tot;
}a[100020];

bool CMP(const stu &a,const stu &b){
	if(a.fl==b.fl&&a.tot==b.tot&&a.zs==b.zs) return a.id<b.id;
	if(a.fl==b.fl&&a.tot==b.tot) return a.zs>b.zs;
	if(a.fl==b.fl) return a.tot>b.tot;
	return a.fl<b.fl;
}

int main(){
	int n,l,h;
	cin>>n>>l>>h;
	int cnt=0;
	for(int i=1;i<=n;i++){
		scanf("%d %d %d",&a[i].id,&a[i].zs,&a[i].yz);
		a[i].tot=a[i].yz+a[i].zs;
		if(a[i].yz<l||a[i].zs<l){
			a[i].fl=9;
		}
		else{
			cnt++;
			if(a[i].yz>=h&&a[i].zs>=h) a[i].fl=1;
			else if(a[i].yz<h&&a[i].zs>=h) a[i].fl=2;
			else if(a[i].yz<h&&a[i].zs<h&&a[i].zs>=a[i].yz) a[i].fl=3;
			else a[i].fl=4;
		}
	}
	sort(a+1,a+1+n,CMP);
	printf("%d\n",cnt);
	for(int i=1;i<=cnt;i++){
		printf("%d %d %d\n",a[i].id,a[i].zs,a[i].yz);
	}
}