結果

問題 No.1433 Two color sequence
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-03-19 22:09:34
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 231 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 33,336 KB
最終ジャッジ日時 2024-11-18 22:41:26
合計ジャッジ時間 5,478 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
a = list(map(int, input().split()))
l = [0]
for i in range(n):
    ri = a[i] if s[i] == "R" else 0
    bi = a[i] if s[i] == "B" else 0
    l.append(l[-1] + (ri - bi))
print(max(l) - min(l))
0