結果

問題 No.1021 Children in Classrooms
コンテスト
ユーザー flippergo
提出日時 2021-01-02 09:56:33
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 103 ms / 2,000 ms
+ 282µs
コード長 397 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 87 ms
コンパイル使用メモリ 80,512 KB
実行使用メモリ 119,296 KB
最終ジャッジ日時 2026-09-14 07:44:19
合計ジャッジ時間 4,062 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from collections import deque
N,M = map(int,input().split())
A = deque(list(map(int,input().split())))
S = input().strip()
cntL = 0
cntR = 0
for i in range(M):
    if S[i]=="L":
        A[-1] += cntR
        cntR = 0
        cntL += A.popleft()
        A.append(0)
    else:
        A[0] += cntL
        cntL = 0
        cntR += A.pop()
        A.appendleft(0)
A[0] += cntL
A[-1] += cntR
print(*A)
0