You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
758 B
32 lines
758 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int N = 110;
|
|
struct Student {
|
|
string Name;
|
|
int year, month, day, num;
|
|
} a[N];
|
|
|
|
bool cmp(const Student &a, const Student &b) {
|
|
if (a.year == b.year)
|
|
if (a.month == b.month)
|
|
if (a.day == b.day)
|
|
return a.num > b.num;
|
|
else
|
|
return a.day < b.day;
|
|
else return a.month < b.month;
|
|
else return a.year < b.year;
|
|
}
|
|
|
|
int main() {
|
|
int n;
|
|
cin >> n;
|
|
for (int i = 1; i <= n; i++) {
|
|
cin >> a[i].Name >> a[i].year >> a[i].month >> a[i].day;
|
|
a[i].num = i;
|
|
}
|
|
sort(a + 1, a + 1 + n, cmp);
|
|
|
|
for (int i = 1; i <= n; i++) cout << a[i].Name << endl;
|
|
return 0;
|
|
} |