結果

問題 No.490 yukiソート
ユーザー shinwisteriashinwisteria
提出日時 2017-03-20 16:10:23
言語 Java21
(openjdk 21)
結果
AC  
実行時間 316 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 3,408 ms
コンパイル使用メモリ 74,596 KB
実行使用メモリ 59,396 KB
最終ジャッジ日時 2023-09-18 12:33:47
合計ジャッジ時間 12,289 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
55,872 KB
testcase_01 AC 141 ms
55,868 KB
testcase_02 AC 139 ms
55,868 KB
testcase_03 AC 139 ms
56,020 KB
testcase_04 AC 196 ms
56,420 KB
testcase_05 AC 195 ms
56,212 KB
testcase_06 AC 200 ms
56,276 KB
testcase_07 AC 198 ms
56,056 KB
testcase_08 AC 199 ms
56,612 KB
testcase_09 AC 201 ms
56,152 KB
testcase_10 AC 202 ms
56,492 KB
testcase_11 AC 198 ms
56,080 KB
testcase_12 AC 197 ms
56,236 KB
testcase_13 AC 198 ms
56,400 KB
testcase_14 AC 314 ms
59,004 KB
testcase_15 AC 310 ms
58,584 KB
testcase_16 AC 312 ms
59,396 KB
testcase_17 AC 311 ms
58,836 KB
testcase_18 AC 304 ms
57,572 KB
testcase_19 AC 298 ms
58,884 KB
testcase_20 AC 316 ms
59,028 KB
testcase_21 AC 302 ms
58,988 KB
testcase_22 AC 295 ms
59,264 KB
testcase_23 AC 313 ms
59,332 KB
testcase_24 AC 141 ms
55,468 KB
testcase_25 AC 140 ms
55,464 KB
testcase_26 AC 143 ms
55,704 KB
testcase_27 AC 146 ms
56,264 KB
testcase_28 AC 143 ms
55,680 KB
testcase_29 AC 143 ms
55,824 KB
testcase_30 AC 144 ms
55,744 KB
testcase_31 AC 146 ms
55,396 KB
testcase_32 AC 142 ms
55,984 KB
testcase_33 AC 143 ms
55,488 KB
testcase_34 AC 142 ms
55,832 KB
testcase_35 AC 144 ms
55,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Yukisort {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt(),med;
		int[] a = new int[n];
		for(int i = 0;i < n;i++){
			a[i] = s.nextInt();
		}
		s.close();
		
		for(int i = 1;i < 2*n-3;i++){
			for(int j = 0;j < (i+1)/2;j++){
				if(i-j >= 0 &&i -j <n){
					med = Integer.max(a[j], a[i-j]);
					if(Integer.compare(a[j], a[i-j]) >0){
						a[j] = a[i-j];
						a[i-j] = med;
					}
				}
			}
		}
		for(int b:a){
			System.out.print(b + " ");
		}
		System.out.println();

	}

}
0