結果

問題 No.1816 MUL-DIV Game
ユーザー kokatsukokatsu
提出日時 2022-01-21 22:19:16
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 94 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 3,338 ms
コンパイル使用メモリ 219,052 KB
実行使用メモリ 18,580 KB
最終ジャッジ日時 2023-09-04 15:47:55
合計ジャッジ時間 5,238 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 8 ms
4,956 KB
testcase_10 AC 37 ms
11,320 KB
testcase_11 AC 32 ms
8,624 KB
testcase_12 AC 23 ms
7,556 KB
testcase_13 AC 50 ms
10,760 KB
testcase_14 AC 27 ms
7,748 KB
testcase_15 AC 35 ms
9,860 KB
testcase_16 AC 9 ms
4,912 KB
testcase_17 AC 74 ms
16,084 KB
testcase_18 AC 71 ms
14,220 KB
testcase_19 AC 32 ms
8,800 KB
testcase_20 AC 78 ms
17,672 KB
testcase_21 AC 24 ms
7,624 KB
testcase_22 AC 18 ms
7,040 KB
testcase_23 AC 1 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 94 ms
18,404 KB
testcase_26 AC 92 ms
18,060 KB
testcase_27 AC 91 ms
18,580 KB
testcase_28 AC 92 ms
18,108 KB
testcase_29 AC 94 ms
18,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

void main() {
    int N;
    readf("%d\n", N);

    auto A = readln.chomp.split.to!(long[]);

    auto rbt = A.redBlackTree!true;
    foreach (i; 0 .. N-1) {
        if (i % 2 == 0) {
            long x = rbt.front;
            rbt.removeFront;

            long y = rbt.front;
            rbt.removeFront;

            rbt.insert(x*y);
        }
        else {
            rbt.removeBack;
            rbt.removeBack;

            rbt.insert(1);
        }
    }

    rbt.front.writeln;
}
0