@[lutaoquan](/user/757413)
>如果有两个同学生日相同,输入靠后的同学先输出
您的代码需要实现这一点
by yuanxiuan @ 2023-02-18 18:02:29
但怎没改呀,是不是还要加一个序号?
by 666__666 @ 2023-02-18 18:06:09
@[lutaoquan](/user/757413) 十分正确
by yuanxiuan @ 2023-02-18 18:11:11
对了,level的排序写反了看成靠前得了
by 666__666 @ 2023-02-18 18:14:21
# 最后一个测试点有同年同月同日的
# [博客主页](https://www.ricemoon.cn/)
```cpp
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define endl "\n"
const int N = 1e5 + 10;
const int M = 110;
int n;
vector<string> s;
int year[N], month[N], day[N];
int cnt = 0;
bool cmp(int x, int y)
{
if (year[x] != year[y]) return year[x] < year[y];
else
{
if (month[x] != month[y]) return month[x] < month[y];
else
{
if (day[x] != day[y]) return day[x] < day[y];
else return x > y;
}
}
}
void solve()
{
cin >> n;
int a[N];
for (int i = 0; i < n; i ++ )
{
string s2;
cin >> s2;
s.push_back(s2);
cin >> year[cnt] >> month[cnt] >> day[cnt];
++ cnt;
}
for (int i = 0; i < n; i ++ ) a[i] = i;
sort(a, a + n, cmp);
for (int i = 0; i < n; i ++ )
{
cout << s[a[i]] << endl;
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
solve();
return 0;
}
```
by Roger_Spencer @ 2023-02-19 16:05:01