#include <bits/stdc++.h> using namespace std; map<int, int> m; pair<int, int> one; vector<pair<int, int>> v; int main() { int N; while (cin >> N) { while (N--) { //利用map对key值(学号)进行默认的升序排序 cin >> one.first >> one.second; m.insert(one); } //map的数据转移到vector进行value值(分数)的排序 v.assign(m.begin(), m.end()); stable_sort(v.begin(), v.end(), [](const pair<int, int>& a, const pair<int, int>& b) { return a.second < b.second; //升序 }); //输出 for (auto it : v) { cout << it.first << " " << it.second << endl; } } }