Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
134305 | 梁颢城 | 双关键字排序 | C++ | 通过 | 100 | 408 MS | 1044 KB | 372 | 2024-03-02 15:30:18 |
#include<bits/stdc++.h> using namespace std; struct st{ int x; int y; }; st l[100001]; bool cmp(st m,st n){ if(m.x>n.x){ return 0; } if(m.x==n.x&&m.y>n.y){ return 0; } return 1; } int main(){ int a; cin>>a; for(int i=1;i<=a;i++) cin>>l[i].x>>l[i].y; sort(l+1,l+a+1,cmp); for(int i=1;i<=a;i++) cout<<l[i].x<<" "<<l[i].y<<endl; }