#include <bits/stdc++.h> using namespace std; class person { public: int no; int score; void say(){ cout<<no<<" "<<score<<endl; } }; bool cmp(person p1,person p2){ if(p1.score == p2.score) return p1.no<p2.no; return p1.score<p2.score; } int main() { int n; cin >> n; person arr[n]; for(int i =0;i<n;i++) { int t1, t2; cin >> t1 >> t2; person p; p.no = t1; p.score = t2; arr[i]=p; } sort(arr,arr+n,cmp); for(auto p: arr) p.say(); } // 64 位输出请用 printf("%lld")
qd