-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1015.cpp
More file actions
57 lines (52 loc) · 1.05 KB
/
1015.cpp
File metadata and controls
57 lines (52 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
struct score{
int id;
int de;
int cai;
};
int com(struct score a, struct score b){
if ((a.de + a.cai) != (b.de + b.cai)){
return (a.de + a.cai) > (b.de + b.cai);
}
else if (a.de != b.de){
return (a.de > b.de);
}
else{
return (a.id < b.id);
}
}
int main(){
int n, l, h;
scanf_s("%d %d %d", &n, &l, &h);
score temp;
vector<score> v[4];
int all = n;
for (int i = 0; i < n; i++){
scanf_s("%d %d %d", &temp.id, &temp.de, &temp.cai);
if (temp.de<l || temp.cai<l)
all--;
else if (temp.de >= h&&temp.cai >= h){
v[0].push_back(temp);
}
else if (temp.de >= h&&temp.cai < h){
v[1].push_back(temp);
}
else if (temp.de < h&&temp.cai < h && (temp.de >= temp.cai)){
v[2].push_back(temp);
}
else
v[3].push_back(temp);
}
printf("%d\n", all);
for (int i = 0; i < 4; i++){
sort(v[i].begin(), v[i].end(), com);
for (int j = 0; j < v[i].size(); j++){
printf("%d %d %d\n", v[i][j].id, v[i][j].de, v[i][j].cai);
}
}
system("pause");
return 0;
}