-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ_10825.cpp
More file actions
46 lines (39 loc) · 763 Bytes
/
BOJ_10825.cpp
File metadata and controls
46 lines (39 loc) · 763 Bytes
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
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Student {
string name;
int k;
int y;
int s;
};
vector<Student> students;
bool cmp(Student a, Student b) {
if (a.k != b.k)
return a.k > b.k;
if (a.y != b.y)
return a.y < b.y;
if (a.s != b.s)
return a.s > b.s;
return a.name < b.name;
}
int main(void) {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string name;
int k, y, s;
cin >> name >> k >> y >> s;
Student student{name, k, y, s};
students.push_back(student);
}
sort(students.begin(), students.end(), cmp);
for (int i = 0; i < n; i++) {
cout << students[i].name << "\n";
}
return 0;
}