結果

問題 No.365 ジェンガソート
ユーザー ikesouikesou
提出日時 2021-03-14 16:29:17
言語 JavaScript
(node v21.7.1)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 5,376 KB
実行使用メモリ 48,968 KB
最終ジャッジ日時 2024-04-23 23:47:48
合計ジャッジ時間 4,866 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
39,040 KB
testcase_01 AC 63 ms
38,784 KB
testcase_02 AC 66 ms
38,656 KB
testcase_03 AC 64 ms
39,040 KB
testcase_04 AC 63 ms
39,168 KB
testcase_05 AC 63 ms
38,784 KB
testcase_06 AC 64 ms
38,912 KB
testcase_07 AC 68 ms
38,784 KB
testcase_08 AC 62 ms
38,784 KB
testcase_09 AC 68 ms
38,784 KB
testcase_10 AC 66 ms
39,040 KB
testcase_11 AC 65 ms
38,784 KB
testcase_12 AC 68 ms
38,784 KB
testcase_13 AC 65 ms
38,784 KB
testcase_14 AC 64 ms
38,656 KB
testcase_15 AC 63 ms
39,040 KB
testcase_16 AC 106 ms
47,808 KB
testcase_17 AC 116 ms
48,700 KB
testcase_18 AC 69 ms
42,752 KB
testcase_19 AC 114 ms
48,284 KB
testcase_20 AC 81 ms
44,288 KB
testcase_21 AC 77 ms
43,776 KB
testcase_22 AC 109 ms
47,792 KB
testcase_23 AC 94 ms
46,592 KB
testcase_24 AC 104 ms
47,652 KB
testcase_25 AC 76 ms
43,648 KB
testcase_26 AC 96 ms
46,916 KB
testcase_27 AC 118 ms
48,828 KB
testcase_28 AC 100 ms
47,060 KB
testcase_29 AC 114 ms
48,640 KB
testcase_30 AC 99 ms
46,944 KB
testcase_31 AC 81 ms
44,032 KB
testcase_32 AC 81 ms
44,032 KB
testcase_33 AC 121 ms
48,828 KB
testcase_34 AC 78 ms
43,264 KB
testcase_35 AC 110 ms
47,528 KB
testcase_36 AC 122 ms
48,840 KB
testcase_37 AC 122 ms
48,584 KB
testcase_38 AC 120 ms
48,968 KB
testcase_39 AC 120 ms
48,904 KB
testcase_40 AC 119 ms
48,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

function main() {
    console.log(solve(load()));
}

function toInt(num) {
    return parseInt(num);
}

function load() {
    const {readFileSync} = require('fs');
    return readFileSync('/dev/stdin', 'utf8');
}

function solve(input) {
    const n = Number(input.split('\n')[0]);
    const block_list = input.split('\n')[1].split(' ').map(toInt);

    let search_number = n;
    let sorted_count = 0;

    for (let i = block_list.length - 1;0 <= i;i--) {
        if (block_list[i] === search_number) {
            search_number--;
            sorted_count++;
        }
    }

    return n - sorted_count;
}

main();
0