結果

問題 No.1021 Children in Classrooms
ユーザー tktk_snsn
提出日時 2021-08-08 19:51:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 299 bytes
コンパイル時間 396 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 30,704 KB
最終ジャッジ日時 2024-09-19 16:31:10
合計ジャッジ時間 5,908 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n, m = map(int, input().split())
a = list(map(int, input().split()))
s = input()

b = deque(a)
for i in s:
    if i == "L":
        x = b.popleft()
        b[0] += x
        b.append(0)
    else:
        x = b.pop()
        b[-1] += x
        b.appendleft(0)

print(*b)
0