結果
| 問題 |
No.1021 Children in Classrooms
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-01-02 09:56:33 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 146 ms / 2,000 ms |
| コード長 | 397 bytes |
| コンパイル時間 | 244 ms |
| コンパイル使用メモリ | 82,080 KB |
| 実行使用メモリ | 107,596 KB |
| 最終ジャッジ日時 | 2024-10-11 23:10:42 |
| 合計ジャッジ時間 | 4,372 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
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)