結果

問題 No.490 yukiソート
ユーザー Naoyk1212Naoyk1212
提出日時 2017-03-10 22:56:16
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 483 bytes
コンパイル時間 1,112 ms
コンパイル使用メモリ 145,496 KB
実行使用メモリ 7,636 KB
最終ジャッジ日時 2023-09-06 15:50:41
合計ジャッジ時間 5,070 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
7,636 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 23 ms
4,376 KB
testcase_05 AC 23 ms
4,376 KB
testcase_06 AC 24 ms
4,380 KB
testcase_07 AC 23 ms
4,376 KB
testcase_08 AC 23 ms
4,380 KB
testcase_09 AC 23 ms
4,380 KB
testcase_10 AC 23 ms
4,376 KB
testcase_11 AC 23 ms
4,376 KB
testcase_12 AC 23 ms
4,376 KB
testcase_13 AC 23 ms
4,376 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
	int n;
	cin >> n;
	vector<int> vec(n);
	for(int i = 0; i < n; i++) cin >> vec[i];
	
	int a = 0;
	while(a < 2 * n - 3){
		for(int i = 0; i < n; i++){
			for(int j = i + 1; j < n; j++){
				
				if(i + j > a) break;
				else if(i + j != a) continue;
				
				if(vec[i] > vec[j]){
					swap(vec[i], vec[j]);
				}
			}
		}
		a++;
	}
	for(int i = 0; i < n; i++) cout << vec[i] << " ";
	cout << endl;
	
}
0