28 unordered_map<student *, unsigned> index;
29 vector<student *> students(n);
30 for(
int i = 0; i < n; i++) {
32 cin >> students[i]->name >> students[i]->score;
33 if(index.find(students[i]) == index.end())
34 index[students[i]] = i;
36 sort(students.begin(), students.end(), [rule, &index](
student *a,
student *b) {
37 if(a->score == b->score) {
38 return index[a] < index[b];
41 return a->score > b->score;
43 return a->score < b->score;
46 for(
const auto &s: students) {
47 cout << s->name <<
' ' << s->score << endl;
struct acwing::acwing3378::student student