提交时间:2023-08-23 09:18:56

运行 ID: 99539

#include <bits/stdc++.h> using namespace std; struct node{ int x,y; }a[100005]; signed main() { int n; cin >> n; for(int i = 1; i <= n; i++) { cin >> a[i].x >> a[i].y; } for(int i = 1; i <= n-1; i++) { for(int j = i+1; j <= n; j++) { if(a[i].x > a[j].x) { swap(a[i],a[j]); } else if(a[i].x == a[j].x) { if(a[i].y > a[j].y) { swap(a[i],a[j]); } } } } for(int i = 1; i <= n; i++) { cout << a[i].x <<" "<< a[i].y<<endl; } return 0; }