結果

問題 No.1021 Children in Classrooms
ユーザー DrDrpilot
提出日時 2022-02-07 18:26:29
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 30,716 KB
最終ジャッジ日時 2024-06-22 02:11:17
合計ジャッジ時間 4,957 ms
ジャッジサーバーID
(参考情報)
judge3 / 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()
q=deque()
for i in a:
    q.append(i)
for i in s:
    if i=='L':
        out1=q.popleft()
        out2=q.popleft()
        q.appendleft(out1+out2)
        q.append(0)
    else:
        out1=q.pop()
        out2=q.pop()
        q.append(out1+out2)
        q.appendleft(0)
print(*q)
0