結果

問題 No.1433 Two color sequence
ユーザー NatsubiSoganNatsubiSogan
提出日時 2021-03-19 22:09:34
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 10,744 KB
実行使用メモリ 30,836 KB
最終ジャッジ日時 2023-08-12 02:26:24
合計ジャッジ時間 5,498 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
7,812 KB
testcase_01 AC 15 ms
7,924 KB
testcase_02 AC 15 ms
7,908 KB
testcase_03 AC 145 ms
11,684 KB
testcase_04 AC 145 ms
11,784 KB
testcase_05 AC 15 ms
7,920 KB
testcase_06 AC 15 ms
7,848 KB
testcase_07 AC 15 ms
7,844 KB
testcase_08 AC 183 ms
30,836 KB
testcase_09 AC 186 ms
30,416 KB
testcase_10 AC 186 ms
29,188 KB
testcase_11 AC 182 ms
29,208 KB
testcase_12 AC 188 ms
29,964 KB
testcase_13 AC 193 ms
29,924 KB
testcase_14 AC 191 ms
30,024 KB
testcase_15 AC 196 ms
30,108 KB
testcase_16 AC 189 ms
30,100 KB
testcase_17 AC 195 ms
30,148 KB
testcase_18 AC 194 ms
30,024 KB
testcase_19 AC 188 ms
30,156 KB
testcase_20 AC 187 ms
30,640 KB
testcase_21 AC 186 ms
30,060 KB
testcase_22 AC 186 ms
29,964 KB
testcase_23 AC 191 ms
29,988 KB
権限があれば一括ダウンロードができます

ソースコード

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