結果

問題 No.1021 Children in Classrooms
ユーザー Azumabashi
提出日時 2020-04-20 22:38:24
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 32,448 KB
最終ジャッジ日時 2024-10-06 09:32:37
合計ジャッジ時間 4,164 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

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