题解
2023-09-02 16:11:26
发布于:广东
9阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
struct people
{
int id,s,d,p;
};
int cmp(people a,people b)
{
if (a.s!=b.s) return a.s>b.s;
else if (a.p!=b.p) return a.p>b.p;
else if (a.d!=b.d) return a.d<b.d;
else return a.id<b.id;
}
int main()
{
int n;
cin >> n;
people ar[n];
for (int i=0;i<n;i++)
cin >> ar[i].id >> ar[i].s >> ar[i].d >> ar[i].p;
sort(ar,ar+n,cmp);
for (int i=0;i<n;i++)
cout << ar[i].id << ' ';
return 0;
}
这里空空如也
有帮助,赞一个