結果
問題 |
No.1021 Children in Classrooms
|
ユーザー |
![]() |
提出日時 | 2021-08-08 19:43:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 701 bytes |
コンパイル時間 | 89 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 30,636 KB |
最終ジャッジ日時 | 2024-09-19 16:23:14 |
合計ジャッジ時間 | 5,910 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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: now = max(0, now) 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)