結果

問題 No.1433 Two color sequence
ユーザー lie_of_lillielie_of_lillie
提出日時 2021-05-06 15:11:35
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 218 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 10,672 KB
実行使用メモリ 30,836 KB
最終ジャッジ日時 2023-10-12 07:46:30
合計ジャッジ時間 4,874 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 16 ms
7,876 KB
testcase_02 AC 16 ms
7,932 KB
testcase_03 AC 125 ms
12,964 KB
testcase_04 AC 121 ms
12,964 KB
testcase_05 AC 16 ms
7,784 KB
testcase_06 AC 16 ms
7,784 KB
testcase_07 AC 16 ms
7,784 KB
testcase_08 AC 154 ms
30,836 KB
testcase_09 AC 181 ms
29,916 KB
testcase_10 AC 171 ms
29,212 KB
testcase_11 AC 174 ms
29,336 KB
testcase_12 AC 175 ms
30,008 KB
testcase_13 AC 177 ms
29,924 KB
testcase_14 AC 169 ms
30,024 KB
testcase_15 AC 170 ms
30,040 KB
testcase_16 AC 167 ms
30,084 KB
testcase_17 AC 167 ms
30,036 KB
testcase_18 AC 173 ms
30,036 KB
testcase_19 AC 182 ms
30,120 KB
testcase_20 AC 176 ms
30,104 KB
testcase_21 AC 178 ms
30,132 KB
testcase_22 AC 177 ms
30,032 KB
testcase_23 AC 180 ms
30,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
S=input()
A=list(map(int, input().split()))

cumsum = [0]
for i, s in enumerate(list(S)):
    if s == "B":
        A[i] = -A[i]
    cumsum.append(cumsum[-1] + A[i])

print(abs(max(cumsum) - min(cumsum)))
0