就最后一个样例没过,谁能帮我看看,谢谢啦
查看原帖
就最后一个样例没过,谁能帮我看看,谢谢啦
1140371
ruanertanjing楼主2024/8/9 15:59
// P1104 生日
// https://www.luogu.com.cn/problem/P1104

#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <cmath>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <functional>
#include <climits>

#define quickio ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define endl "\n"

using namespace std;
typedef long long ll;

struct Stu
{
	string name;
	int year;
	int month;
	int day;
};

bool cmp(Stu s1, Stu s2)
{
	if (s1.year != s2.year)
		return s1.year < s2.year;
	if (s1.month != s2.month)
		return s1.month < s2.month;
	if (s1.day != s2.day)
		return s1.day < s2.day;

	return false;/**/
}

void solve()
{
	int n;
	cin >> n;
	vector<Stu>v(n);
	for (int i = 0; i < n; i++)
	{
		cin >> v[i].name >> v[i].year >> v[i].month >> v[i].day;
	}
	sort(v.begin(), v.end(), cmp);
	for (int i = 0; i < n; i++)
	{
		cout << v[i].name << endl;
	}
}

int main()
{
	solve();
	return 0;
}
2024/8/9 15:59
加载中...