求助大佬,有一个点过不了

P1104 生日

# 最后一个测试点有同年同月同日的 # [博客主页](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:45


|