Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
166571 | 林荣鑫 | 常用排序法 | C++ | 解答错误 | 85 | 158 MS | 131308 KB | 377 | 2024-08-19 14:53:03 |
#include<iostream> #include<algorithm> using namespace std; struct Pair{ int first; }; 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; } sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++){ cout<<a[i].first<<' '; } }