結果

問題 No.490 yukiソート
ユーザー 37zigen37zigen
提出日時 2017-03-10 23:07:57
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 729 bytes
コンパイル時間 3,836 ms
コンパイル使用メモリ 79,324 KB
実行使用メモリ 62,252 KB
最終ジャッジ日時 2023-09-06 15:57:18
合計ジャッジ時間 11,340 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 154 ms
56,788 KB
testcase_01 AC 153 ms
57,044 KB
testcase_02 AC 154 ms
56,860 KB
testcase_03 AC 155 ms
56,624 KB
testcase_04 AC 197 ms
56,960 KB
testcase_05 WA -
testcase_06 AC 198 ms
57,164 KB
testcase_07 WA -
testcase_08 AC 199 ms
56,920 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 204 ms
57,120 KB
testcase_12 AC 206 ms
57,356 KB
testcase_13 AC 206 ms
57,220 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 306 ms
62,252 KB
testcase_19 WA -
testcase_20 AC 309 ms
59,868 KB
testcase_21 WA -
testcase_22 AC 307 ms
60,016 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 153 ms
57,024 KB
testcase_26 AC 156 ms
57,252 KB
testcase_27 AC 154 ms
56,788 KB
testcase_28 AC 154 ms
57,068 KB
testcase_29 AC 155 ms
57,196 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 156 ms
56,620 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 155 ms
56,900 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
		}
		for (int i = 1; i < 2 * n - 3; ++i) {
			int s = 0;
			int t = i;
			while (t - s > 1) {
				if (t < n && a[s] > a[t]) {
					int d = a[s];
					a[s] = a[t];
					a[t] = d;
				}
				++s;
				--t;
			}
		}
		for (int i = 0; i < n; ++i) {
			System.out.print(a[i] + (i == n - 1 ? "\n" : " "));
		}
	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}
0