提交时间:2024-03-02 15:14:13

运行 ID: 134232

#include <bits/stdc++.h> using namespace std; const int N = 1e5; struct node { int p , q; }a[N]; bool cmp(node x , node y) { if(x.p != y.p) return x.p < y.p; return x.q < y.q; } int main() { int n; cin >> n; for(int i =1 ;i <= n;i++) cin >> a[i].p >> a[i].q; sort(a + 1 , a + n + 1,cmp); for(int i = 1;i <= n;i++) cout << a[i].p << " " << a[i].q << endl; return 0; }