結果

問題 No.1021 Children in Classrooms
ユーザー yansi819
提出日時 2024-05-11 09:08:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 325 bytes
コンパイル時間 335 ms
コンパイル使用メモリ 82,668 KB
実行使用メモリ 101,592 KB
最終ジャッジ日時 2024-12-20 08:18:04
合計ジャッジ時間 4,167 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque

N, M = map(int, input().split())
a = deque(map(int, input().split()))
S = input()
for i in range(M):
    if (S[i] == 'L'):
        b = a[0]
        a.popleft()
        a[0] += b
        a.append(0)
    else:
        b = a[-1]
        a.pop()
        a[-1] += b
        a.appendleft(0)
print(*a)
0