結果

問題 No.490 yukiソート
ユーザー square1001
提出日時 2017-03-07 15:24:27
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 15 ms / 2,000 ms
コード長 501 bytes
コンパイル時間 772 ms
コンパイル使用メモリ 85,336 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-24 08:21:17
合計ジャッジ時間 2,134 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <ctime>
#include <random>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int n;
int main() {
	ios_base::sync_with_stdio(false);
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i <= 2 * n - 4; i++) {
		for (int j = 0; j < n; j++) {
			int k = i - j;
			if (j < k && 0 <= k && k < n && a[j] > a[k]) swap(a[j], a[k]);
		}
	}
	for (int i = 0; i < n; i++) {
		if (i) cout << ' ';
		cout << a[i];
	}
	cout << endl;
	return 0;
}
0