Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
134265 | 吴悠 | 双关键字排序 | C++ | 通过 | 100 | 408 MS | 1044 KB | 458 | 2024-03-02 15:19:00 |
#include<iostream> #include<algorithm> using namespace std; struct A{ int a; int b; }a[100001]; bool cmp(A x,A y){ if(x.a<y.a){ return true; } else if(x.a==y.a){ if(x.b<y.b){ return true; } else return false; } else return false; } int main(){ int n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].a>>a[i].b; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++){ cout<<a[i].a<<" "<<a[i].b<<endl; } return 0; }