結果

問題 No.490 yukiソート
ユーザー htensaihtensai
提出日時 2019-12-26 10:48:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 261 ms / 2,000 ms
コード長 905 bytes
コンパイル時間 3,369 ms
コンパイル使用メモリ 74,436 KB
実行使用メモリ 57,000 KB
最終ジャッジ日時 2024-04-14 07:55:50
合計ジャッジ時間 11,491 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
54,348 KB
testcase_01 AC 135 ms
54,256 KB
testcase_02 AC 135 ms
54,164 KB
testcase_03 AC 137 ms
54,028 KB
testcase_04 AC 180 ms
54,716 KB
testcase_05 AC 164 ms
54,368 KB
testcase_06 AC 170 ms
54,200 KB
testcase_07 AC 174 ms
54,232 KB
testcase_08 AC 178 ms
54,200 KB
testcase_09 AC 166 ms
54,324 KB
testcase_10 AC 187 ms
54,604 KB
testcase_11 AC 163 ms
54,424 KB
testcase_12 AC 164 ms
54,348 KB
testcase_13 AC 167 ms
54,192 KB
testcase_14 AC 242 ms
56,968 KB
testcase_15 AC 248 ms
57,000 KB
testcase_16 AC 261 ms
56,860 KB
testcase_17 AC 250 ms
56,716 KB
testcase_18 AC 257 ms
56,880 KB
testcase_19 AC 256 ms
56,700 KB
testcase_20 AC 255 ms
56,952 KB
testcase_21 AC 259 ms
56,880 KB
testcase_22 AC 254 ms
56,980 KB
testcase_23 AC 252 ms
56,976 KB
testcase_24 AC 136 ms
54,004 KB
testcase_25 AC 134 ms
54,196 KB
testcase_26 AC 133 ms
54,232 KB
testcase_27 AC 133 ms
53,980 KB
testcase_28 AC 132 ms
54,032 KB
testcase_29 AC 136 ms
53,896 KB
testcase_30 AC 136 ms
54,216 KB
testcase_31 AC 132 ms
53,904 KB
testcase_32 AC 132 ms
53,980 KB
testcase_33 AC 131 ms
54,396 KB
testcase_34 AC 138 ms
54,276 KB
testcase_35 AC 134 ms
54,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        for (int i = 1; i < 2 * n - 3; i++) {
            for (int p = 0; i - p > p; p++) {
                int q = i - p;
                if (q >= n) {
                    continue;
                }
                if (arr[p] > arr[q]) {
                    int tmp = arr[p];
                    arr[p] = arr[q];
                    arr[q] = tmp;
                }
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < n; i++) {
            if (i != 0) {
                sb.append(" ");
            }
            sb.append(arr[i]);
        }
        System.out.println(sb);
    }
}
0