結果

問題 No.1021 Children in Classrooms
ユーザー _matumo_
提出日時 2020-09-25 14:23:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 229 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 465 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 29,448 KB
最終ジャッジ日時 2024-06-28 05:48:54
合計ジャッジ時間 4,180 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
def main():
    N,M=map(int,input().split())
    d=deque(map(int,input().split()))
    S=input()
    for c in S:
        if c=='L':
            n=d.popleft()
            d[0]+=n
            d.append(0)
        if c=='R':
            n=d.pop()
            d[-1]+=n
            d.appendleft(0)
    print(*d)
main()
0