結果

問題 No.490 yukiソート
ユーザー testtest
提出日時 2022-11-24 15:54:23
言語 JavaScript
(node v21.7.1)
結果
WA  
実行時間 -
コード長 434 bytes
コンパイル時間 187 ms
コンパイル使用メモリ 6,932 KB
実行使用メモリ 43,648 KB
最終ジャッジ日時 2024-04-08 13:12:22
合計ジャッジ時間 6,047 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
37,632 KB
testcase_01 AC 71 ms
37,632 KB
testcase_02 AC 73 ms
37,632 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 69 ms
37,760 KB
testcase_25 AC 70 ms
37,632 KB
testcase_26 AC 68 ms
37,632 KB
testcase_27 AC 67 ms
37,632 KB
testcase_28 AC 69 ms
37,632 KB
testcase_29 AC 67 ms
37,632 KB
testcase_30 AC 68 ms
37,632 KB
testcase_31 AC 69 ms
37,632 KB
testcase_32 AC 68 ms
37,632 KB
testcase_33 AC 69 ms
37,632 KB
testcase_34 AC 68 ms
37,632 KB
testcase_35 AC 70 ms
37,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function Main(input) {
    const src = input.split("\n");
    const n = parseInt(src[0]);
    const a = 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 && q <= n - 1 && a[p] > a[q])
                [a[p], a[q]] = [a[q], a[p]];
        }
    }
    console.log(a.join(" "));
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
0