#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
struct pepole {
string name;
int k;
int e;
int m;
};
bool compare(const pepole &a,const pepole &b){
if (a.k != b.k) {
return a.k > b.k;
}
if (a.e != b.e){
return a.e < b.e;
}
if (a.m != b.m) {
return a.m > b.m;
}
return a.name < b.name;
}
int main() {
int n;
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
pepole aerr[100000];
for (int i = 0;i < n ;i++ ) {
cin >> aerr[i].name >> aerr[i].k >> aerr[i].e >> aerr[i].m;
}
// sort(aerr,aerr+n,compare);
sort(aerr, aerr + n, [](const pepole &a,const pepole &b)
{
if (a.k != b.k) {
return a.k > b.k;
}
if (a.e != b.e){
return a.e < b.e;
}
if (a.m != b.m) {
return a.m > b.m;
}
return a.name < b.name;
});
for (int i = 0;i < n ;i++) {
cout << aerr[i].name << "\n";
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: