求助64,最后两个WA(急)
  • 板块P1104 生日
  • 楼主Wrongcepted
  • 当前回复0
  • 已保存回复0
  • 发布时间2024/7/31 16:32
  • 上次更新2024/7/31 16:36:19
查看原帖
求助64,最后两个WA(急)
948943
Wrongcepted楼主2024/7/31 16:32
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
//This c++ file is for solving problem:
struct node{
	string n;
	int y,m,d,i;
}a[1000000];
int n;
bool cmp(node x,node y){
	if(x.y!=y.y)return x.y<y.y;
	if(x.m!=y.m)return x.m<y.m;
	if(x.d!=y.d)return x.d<y.d;
	return x.i<y.i;
}
int main(){
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].n>>a[i].y>>a[i].m>>a[i].d;
		a[i].i=i;
	}
	sort(a+1,a+1+n,cmp);
	for(int i=1;i<=n;i++){
		cout<<a[i].n<<endl;
	}
	return 0;
}

2024/7/31 16:32
加载中...