結果

問題 No.1021 Children in Classrooms
ユーザー kokatsukokatsu
提出日時 2022-12-15 22:11:45
言語 D
(dmd 2.106.1)
結果
AC  
実行時間 117 ms / 2,000 ms
コード長 547 bytes
コンパイル時間 3,159 ms
コンパイル使用メモリ 216,508 KB
実行使用メモリ 25,928 KB
最終ジャッジ日時 2023-09-04 19:23:07
合計ジャッジ時間 7,788 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 3 ms
5,696 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 3 ms
4,384 KB
testcase_09 AC 117 ms
24,784 KB
testcase_10 AC 116 ms
23,624 KB
testcase_11 AC 116 ms
23,900 KB
testcase_12 AC 113 ms
23,896 KB
testcase_13 AC 115 ms
23,916 KB
testcase_14 AC 113 ms
23,836 KB
testcase_15 AC 88 ms
21,368 KB
testcase_16 AC 87 ms
21,116 KB
testcase_17 AC 91 ms
20,816 KB
testcase_18 AC 109 ms
25,928 KB
testcase_19 AC 26 ms
10,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std;

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

    auto a = readln.chomp.split.to!(int[]);

    string S;
    readf("%s\n", S);

    auto d = new DList!int(a);
    foreach (s; S) {
        if (s == 'L') {
            auto f = d.front;
            d.removeFront;
            d.front += f;
            d.insertBack(0);
        }
        else {
            auto b = d.back;
            d.removeBack;
            d.back += b;
            d.insertFront(0);
        }
    }

    auto res = d.array;
    writefln("%(%s %)", res);
}
0