結果

問題 No.1021 Children in Classrooms
ユーザー titia
提出日時 2020-04-10 21:29:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 262 ms / 2,000 ms
コード長 271 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 29,324 KB
最終ジャッジ日時 2024-09-15 19:12:50
合計ジャッジ時間 4,272 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N,M=map(int,input().split())
A=deque(map(int,input().split()))
S=input()

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

print(*A)

0