結果

問題 No.1021 Children in Classrooms
ユーザー AzumabashiAzumabashi
提出日時 2020-04-20 22:38:24
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 982 ms
コンパイル使用メモリ 10,784 KB
実行使用メモリ 33,584 KB
最終ジャッジ日時 2023-07-28 16:50:10
合計ジャッジ時間 5,348 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,644 KB
testcase_01 AC 18 ms
8,548 KB
testcase_02 AC 18 ms
8,548 KB
testcase_03 AC 19 ms
8,636 KB
testcase_04 AC 19 ms
8,704 KB
testcase_05 AC 20 ms
8,760 KB
testcase_06 AC 20 ms
8,740 KB
testcase_07 AC 20 ms
8,756 KB
testcase_08 AC 20 ms
8,864 KB
testcase_09 AC 150 ms
33,584 KB
testcase_10 AC 149 ms
33,268 KB
testcase_11 AC 150 ms
33,448 KB
testcase_12 AC 150 ms
32,644 KB
testcase_13 AC 151 ms
32,608 KB
testcase_14 AC 150 ms
32,660 KB
testcase_15 AC 120 ms
25,616 KB
testcase_16 AC 122 ms
25,668 KB
testcase_17 AC 125 ms
26,560 KB
testcase_18 AC 150 ms
31,368 KB
testcase_19 AC 45 ms
10,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque


def main():
    n, m = map(int, input().split())
    a = [int(x) for x in input().split()]
    s = list(input())
    a = deque(a)
    for now_op in s:
        if now_op == "L":
            left = a.popleft()
            left += a.popleft()
            a.appendleft(left)
            a.append(0)
        else:
            right = a.pop()
            right += a.pop()
            a.append(right)
            a.appendleft(0)
    print(" ".join(map(str, list(a))))


if __name__ == '__main__':
    main()

0