提交时间:2024-08-20 13:57:58
运行 ID: 168867
#include <iostream> #include <algorithm> using namespace std; struct aa { int a; int b; }c[10000]; bool cmp(aa a,aa b){ return a.a==b.a?a.b<b.b:a.a<b.a; } int main() { int n; cin>>n; for (int i = 0; i < n; i++){ cin>>c[i].a>>c[i].b; } sort(c,c+n,cmp); for (int i = 0; i < n; i++){ cout<<c[i].a<<' '<<c[i].b<<endl; } return 0; }