没难度上代码。
#include<bits/stdc++.h>
using namespace std;
struct node {
int id, val, t, sum;
};
vector<vector<node>> v(4);
bool cmp (node a, node b) {
if (a.sum != b.sum) return a.sum > b.sum;
else if (a.val != b.val) return a.val > b.val;
return a.id < b.id;
}
int main() {
int n, l, h, id, val, t;
scanf ("%d %d %d", &n, &l, &h);
for (int i = 0; i < n; i++) {
scanf ("%d %d %d", &id, &val, &t);
if (val >= l && t >= l) {
if (val >= h && t >= h)
v[0].push_back(node{id, val, t, val + t});
else if (t < h && val >= h)
v[1].push_back(node{id, val, t, val + t});
else if (t < h && val < h && val >= t)
v[2].push_back(node{id, val, t, val + t});
else
v[3].push_back(node{id, val, t, val + t});
}
}
cout << v[0].size() + v[1].size() + v[2].size() + v[3].size() << endl;
for (int i = 0; i < 4; i++) {
sort (v[i].begin(), v[i].end(), cmp);
for (int j = 0; j < v[i].size(); j++) {
printf ("%08d %d %d\n", v[i][j].id, v[i][j].val, v[i][j].t);
}
}
}