結果

問題 No.1021 Children in Classrooms
ユーザー aaaaaaaaaa2230
提出日時 2022-03-27 22:58:12
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 166 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 265 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 107,904 KB
最終ジャッジ日時 2024-11-06 15:41:53
合計ジャッジ時間 4,320 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

S = input()
for s in S:
    if s == "L":
        x = A.popleft()
        A[0] += x
        A.append(0)
    
    if s == "R":
        x = A.pop()
        A[-1] += x
        A.appendleft(0)

print(*list(A))
0