結果

問題 No.490 yukiソート
ユーザー Naoyk1212Naoyk1212
提出日時 2017-03-10 23:00:56
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 498 bytes
コンパイル時間 1,349 ms
コンパイル使用メモリ 145,512 KB
実行使用メモリ 8,760 KB
最終ジャッジ日時 2023-09-06 15:53:13
合計ジャッジ時間 5,582 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,760 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 19 ms
4,380 KB
testcase_05 AC 19 ms
4,376 KB
testcase_06 AC 19 ms
4,380 KB
testcase_07 AC 18 ms
4,376 KB
testcase_08 AC 18 ms
4,376 KB
testcase_09 AC 18 ms
4,376 KB
testcase_10 AC 19 ms
4,376 KB
testcase_11 AC 19 ms
4,380 KB
testcase_12 AC 18 ms
4,376 KB
testcase_13 AC 18 ms
4,380 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];
	
	for(int i = 1; i < 2 * n - 3; i++){
		for(int j = 0; j < n; j++){
			if(j > i)break;
			
			for(int k = j + 1; k < n; k++){
				if(j + k == i){
					if(vec[j] > vec[k]){
						swap(vec[j], vec[k]);
					}
				}else if(j + k > i){
					break;
				}
			}
		}
	}
	for(int i = 0; i < n; i++) cout << vec[i] << " ";
	cout << endl;
	
}
0