yushui666 @ 2024-11-15 20:11:01
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
struct fc
{
string x;
int y;
int z;
int d;
int id;
}a[50004];
unsigned int n;
bool com(fc a, fc b)
{
if (a.y == b.y)
{
if (a.z == b.z)
{
if (a.d == b.d)
{
return a.id < b.id;
}
else
{
return a.d < b.d;
}
}
else
{
return a.z < b.z;
}
}
else
{
return a.y < b.y;
}
}
int main()
{
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> a[i].x >> a[i].y >> a[i].z>>a[i].d;
a[i].id = i;
}
sort(a, a + n,com);
for (int j = 0; j < n; j++)
{
cout << a[j].x << endl;
}
return 0;
}
by sll00 @ 2024-11-15 20:17:31
@nieyuqing
//return a.id < b.id;这里错了
按照题目的要求是,id大的输出就好了
return a.id > b.id;
by yushui666 @ 2024-11-15 20:20:59
@sll00刚发完就看出来了,谢谢,已关