結果
| 問題 |
No.1021 Children in Classrooms
|
| コンテスト | |
| ユーザー |
tktk_snsn
|
| 提出日時 | 2021-08-08 19:41:38 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 679 bytes |
| コンパイル時間 | 205 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 30,752 KB |
| 最終ジャッジ日時 | 2024-09-19 16:21:31 |
| 合計ジャッジ時間 | 5,657 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 6 |
ソースコード
from collections import deque
n, m = map(int, input().split())
a = list(map(int, input().split()))
s = input()
rmax = 0
lmax = 0
now = 0
for i in s:
if i == "L":
now -= 1
else:
now += 1
rmax = max(rmax, now)
lmax = max(lmax, -now)
now = min(now, n-1)
now = max(now, -n)
ans = [0] * n
if rmax + lmax >= n - 1:
ans[now] = sum(a)
else:
for i in range(lmax):
a[lmax] += a[i]
a[i] = 0
for i in range(rmax):
a[n-1-rmax] += a[n-1-i]
a[n-1-i] = 0
if now >= 0:
for i in range(now, n):
ans[i] = a[i-now]
else:
for i in range(n+now):
ans[i] = a[i-now]
print(*ans)
tktk_snsn