結果

問題 No.1021 Children in Classrooms
ユーザー c-yan
提出日時 2020-04-10 21:55:22
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 270 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 425 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 30,712 KB
最終ジャッジ日時 2024-09-15 20:15:52
合計ジャッジ時間 4,720 ms
ジャッジサーバーID
(参考情報)
judge3 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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(a)
for c in S:
    if c == 'L':
        t = q.popleft()
        q[0] += t
        q.append(0)
    elif c == 'R':
        t = q.pop()
        q[-1] += t
        q.appendleft(0)
print(*q)
0