提交时间:2024-08-20 14:57:01

运行 ID: 168940

#include <bits/stdc++.h> using namespace std; struct node{ int x,y; }a[100001]; bool cmp(node a,node b){ if(a.x > b.x) return a.x < b.x; else if(a.x == b.x) return a.y < b.y; } int main(){ int n; cin >> n; for(int i = 0;i < n;i++){ cin >> a[i].x >> a[i].y; } sort(a,a + n,cmp); for(int i = 0;i < n;i++){ cout << a[i].x << ' ' << a[i].y; if(i != n - 1) cout << endl; } return 0; }