提交时间:2023-09-02 14:17:08
运行 ID: 100768
#include <bits/stdc++.h> using namespace std; struct sorts{ int num1; int num2; }srt[100005]; int cmp(const sorts &a,const sorts &b){ if(a.num1!=b.num1)return a.num1<b.num1; else return a.num2<b.num2; } int main(){ int n; cin>>n; for(int i = 0;i<n;i++){ cin>>srt[i].num1>>srt[i].num2; } sort(srt,srt+n,cmp); for(int i = 0;i<n;i++){ cout<<srt[i].num1<<" "<<srt[i].num2<<endl; } return 0; }