| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 168116 | Microsoft | 常用排序法 | C++ | Time Limit Exceeded | 95 | 2063 MS | 652 KB | 431 | 2024-08-19 22:45:56 |
#include<algorithm> #include<iostream> using namespace std; int n,a[100001]; void selection_sort(int l,int r){ int length=r-l+1; for(int i=1;i<=length;i++){ int aim=l+i-1; for(int j=l+i-1;j<=r;j++) if(a[j]<a[aim]) aim=j; swap(a[l+i-1],a[aim]); } } int main(){ ios::sync_with_stdio(0); cin>>n; for(int i=1;i<=n;i++) cin>>a[i]; selection_sort(1,n); for(int i=1;i<=n;i++) cout<<a[i]<<' '; return 0; }