题干
c++实现
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;struct student {int id;int score;
};bool compare(student a, student b) {if (a.score > b.score) {return false;}else if (a.score == b.score && a.id > b.id) {return false;}else {return true;}
}int main() {int N;scanf("%d", &N);vector<student> s(N);for (int i = 0; i < N; i++){scanf("%d%d", &s[i].id, &s[i].score);}sort(s.begin(), s.end(), compare);for (int i = 0; i < N; i++){printf("%d %d\n", s[i].id, s[i].score);}return 0;
}