結果
| 問題 | No.1021 Children in Classrooms |
| コンテスト | |
| ユーザー |
Valkyrja
|
| 提出日時 | 2020-05-13 01:01:59 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 493 ms / 2,000 ms |
| コード長 | 416 bytes |
| コンパイル時間 | 114 ms |
| コンパイル使用メモリ | 12,544 KB |
| 実行使用メモリ | 31,832 KB |
| 最終ジャッジ日時 | 2024-09-14 04:39:52 |
| 合計ジャッジ時間 | 7,339 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge6 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 17 |
ソースコード
n,m=map(int,input().split())
a=[int(j) for j in input().split()]
s=input()
l,r=0,0
p,q,tmp=0,0,0
for i in s:
if i=="L":
r=min(n-1,r+1)
l=max(0,l-1)
tmp-=1
p=max(p,-tmp)
else:
l=min(n-1,l+1)
r=max(0,r-1)
tmp+=1
q=max(q,tmp)
if p+q>=n:
ans=[0]*l+[sum(a)]+[0]*r
else:
ans=[0]*l+[sum(a[:p+1])]+a[p+1:-q-1]+[sum(a[-q-1:])]+[0]*r
print(*ans)
Valkyrja