結果
問題 |
No.1021 Children in Classrooms
|
ユーザー |
![]() |
提出日時 | 2021-08-08 19:34:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 553 bytes |
コンパイル時間 | 134 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 31,952 KB |
最終ジャッジ日時 | 2024-09-19 16:13:33 |
合計ジャッジ時間 | 6,401 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 9 |
ソースコード
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 = max(0, now) now = min(n-1, now) 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 for i in range(now, n): ans[i] = a[i-now] print(*ans)