提交时间:2024-08-19 21:39:40

运行 ID: 167986

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