結果

問題 No.490 yukiソート
ユーザー Yasufu12
提出日時 2017-03-10 22:58:51
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 475 bytes
コンパイル時間 464 ms
コンパイル使用メモリ 57,828 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 10:16:49
合計ジャッジ時間 1,751 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>

using namespace std;

int n, a[5000];

int main(){
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
	}

	for (int i = 0; i < 2 * n - 3; i++){
		int p = 0;

		for (int j = 0; j < n; j++){
			if (i - j > j && i - j < n){
				if (a[j] > a[i - j]){
					int box = a[j];
					a[j] = a[i - j];
					a[i - j] = box;
				}
			}
		}
	}

	for (int i = 0; i < n - 1; i++){
		cout << a[i] << " ";
	}
	cout << a[n - 1] << "\n";

	return 0;
}
0