結果

問題 No.1021 Children in Classrooms
ユーザー hiraku
提出日時 2020-04-12 20:14:20
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 258 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 30,708 KB
最終ジャッジ日時 2024-09-22 07:39:35
合計ジャッジ時間 4,680 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 s in S:
  if s == "L":
    x = q.popleft()
    q[0] += x
    q.append(0)
  else:
    x = q.pop()
    q[-1] += x
    q.appendleft(0)

print(*q)
0