Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
166493 | 林荣鑫 | 双关键字排序 | C++ | 通过 | 100 | 76 MS | 1028 KB | 414 | 2024-08-19 14:42:20 |
#include<iostream> #include<algorithm> using namespace std; struct Pair{ int first,second; }; bool cmp(Pair a,Pair b){ if(a.first!=b.first)return a.first<b.first; return a.second<b.second; } int main(){ int n; Pair a[100000]; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i].first>>a[i].second; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++){ cout<<a[i].first<<' '<<a[i].second<<'\n'; } }