提交时间:2024-03-02 15:19:47
运行 ID: 134272
#include<iostream> #include<algorithm> using namespace std; const int N = 1e5 + 10; int n; struct cb{ int x, y; bool operator < (const cb & o) const{ if(x == o.x){ return y < o.y; } return x < o.x; } } a[N]; int main(){ cin >> n; for(int i = 0; i < n; i++){ cin >> a[i].x >> a[i].y; } sort(a, a + n); for(int i = 0; i < n; i++){ cout << a[i].x << ' ' << a[i].y << endl; } return 0; }