結果
問題 | No.490 yukiソート |
ユーザー |
|
提出日時 | 2018-03-16 12:06:56 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 2,000 ms |
コード長 | 462 bytes |
コンパイル時間 | 1,373 ms |
コンパイル使用メモリ | 167,484 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-12-21 14:22:07 |
合計ジャッジ時間 | 2,450 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 34 |
ソースコード
#include <bits/stdc++.h>using namespace std;int a[ 2010 ];int main(){int i;int p;int q;int n;int iLim;cin >> n;for( i = 0; i < n; i++ ) cin >> a[ i ];iLim = 2 * n - 3;for( i = 1; i < iLim; i++ ){for( p = 0; 2 * p < i && p < n && p < iLim; p++ ){q = i - p;if( q >= 0 && q < n ){if( a[ p ] > a[ q ] ) swap( a[ p ], a[ q ] );}}}for( i = 0; i < n; i++ ) cout << a[ i ] << " ";cout << endl;return 0;}