提交时间:2024-08-19 19:57:00
运行 ID: 167875
#include<cstdio> #include<algorithm> struct number { int num1; int num2; }a[114514]; bool cmp(number x,number y) { if(x.num1==y.num1)return x.num2<y.num2; return x.num1<y.num1; } int main() { int n,i; scanf("%d",&n); for(i=1;i<=n;i++)scanf("%d %d",&a[i].num1,&a[i].num2); std::sort(a+1,a+n+1,cmp); for(i=1;i<=n;i++)printf("%d %d\n",a[i].num1,a[i].num2); return 0; }