結果
問題 | No.490 yukiソート |
ユーザー | xuelei |
提出日時 | 2018-07-28 12:43:14 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 375 bytes |
コンパイル時間 | 492 ms |
コンパイル使用メモリ | 61,764 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 18:22:37 |
合計ジャッジ時間 | 1,448 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; using ll=long long; int main(){ ll n; cin >> n; vector<ll> a(n); for(ll i=0;i<n;i++)cin >> a[i]; for(ll i=1;i<n*2-3;i++){ for(ll p=0;p<i-p&&p<n-1;p++){ if(a[p]>a[i-p]&&i-p<n)swap(a[p],a[i-p]); } } for(ll i=0;i<n;i++)cout << a[i] << " "; cout << endl; return 0; }