提交时间:2023-08-23 11:14:05
运行 ID: 99594
#include<bits/stdc++.h> using namespace std; int a[10005], b[10005]; int main(){ int n; cin >> n; for (int i = 1; i <= n; i++){ cin >> a[i] >> b[i]; } for (int i = 1; i <= n; i++){ for (int j = i + 1; j <= n; j++){ if (a[i] > a[j]){ swap(a[i], a[j]); swap(b[i], b[j]); } else if (a[i] == a[j] && b[i] > b[j]){ swap(a[i], a[j]); swap(b[i], b[j]); } else if(a[i] < a[j] && b[i] == b[j] || b[i] < b[j]){ continue; } } } for (int i = 1; i <= n; i++){ cout << a[i] << " " << b[i] << endl; } return 0; }