有大佬帮我看看哪里错了吗,最后两个测试点WA(感谢
64分代码:
#include<bits/stdc++.h>
using namespace std;
int y,m,d,q;
struct str{
string n;
long long int j;
int i;
}a[101];
bool cmp(str a, str b){
if(a.j<b.j) return 1;
else if(a.j==b.j){
if(a.i<b.i) return 1;
else return 0;
}
else return 0;
}
int main(){
cin>>q;
for(int w=1;w<=q;w++){
cin>>a[w].n>>y>>m>>d;
a[w].i=w;
a[w].j=y*10000+m*100+d;
}
stable_sort(a+1,a+q+1,cmp);
for(int w=1;w<=q;w++){
cout<<a[w].n<<endl;
}
}