結果

問題 No.490 yukiソート
ユーザー testtest
提出日時 2022-11-24 16:30:19
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 515 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 6,548 KB
実行使用メモリ 43,648 KB
最終ジャッジ日時 2024-04-08 13:51:39
合計ジャッジ時間 5,393 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
37,632 KB
testcase_01 AC 70 ms
37,632 KB
testcase_02 AC 70 ms
37,632 KB
testcase_03 AC 71 ms
37,632 KB
testcase_04 AC 256 ms
43,648 KB
testcase_05 AC 87 ms
42,116 KB
testcase_06 AC 83 ms
42,128 KB
testcase_07 AC 85 ms
42,128 KB
testcase_08 AC 84 ms
42,124 KB
testcase_09 AC 83 ms
42,116 KB
testcase_10 AC 82 ms
42,112 KB
testcase_11 AC 84 ms
42,116 KB
testcase_12 AC 86 ms
42,112 KB
testcase_13 AC 84 ms
42,108 KB
testcase_14 AC 147 ms
42,248 KB
testcase_15 AC 147 ms
42,256 KB
testcase_16 AC 147 ms
42,244 KB
testcase_17 AC 145 ms
42,252 KB
testcase_18 AC 145 ms
42,252 KB
testcase_19 AC 146 ms
42,252 KB
testcase_20 AC 144 ms
42,248 KB
testcase_21 AC 149 ms
42,252 KB
testcase_22 AC 148 ms
42,248 KB
testcase_23 AC 148 ms
42,248 KB
testcase_24 AC 72 ms
37,760 KB
testcase_25 AC 72 ms
37,632 KB
testcase_26 AC 72 ms
37,632 KB
testcase_27 AC 71 ms
37,632 KB
testcase_28 AC 71 ms
37,632 KB
testcase_29 AC 71 ms
37,632 KB
testcase_30 AC 72 ms
37,632 KB
testcase_31 AC 72 ms
37,632 KB
testcase_32 AC 71 ms
37,632 KB
testcase_33 AC 70 ms
37,632 KB
testcase_34 AC 69 ms
37,632 KB
testcase_35 AC 70 ms
37,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function arrInt(arr) {
    return arr.map(str => parseInt(str, 10));
}
function Main(input) {
    const src = input.split("\n");
    const n = parseInt(src[0]);
    const a = arrInt(src[1].split(" "));
    for (let i = 1; i < 2 * n - 3; i++) {
        for (let p = 0; p < n - 1; p++) {
            let q = i - p;
            if (p < q && a[p] > a[q]) {
                [a[p], a[q]] = [a[q], a[p]];
            }
        }
    }
    console.log(a.join(" "));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0