結果

問題 No.1433 Two color sequence
ユーザー lie_of_lillielie_of_lillie
提出日時 2021-06-14 00:37:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 201 bytes
コンパイル時間 104 ms
コンパイル使用メモリ 10,540 KB
実行使用メモリ 32,548 KB
最終ジャッジ日時 2023-08-25 03:51:10
合計ジャッジ時間 5,545 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,592 KB
testcase_01 AC 18 ms
8,464 KB
testcase_02 AC 18 ms
8,544 KB
testcase_03 AC 116 ms
12,264 KB
testcase_04 AC 123 ms
12,264 KB
testcase_05 AC 18 ms
8,392 KB
testcase_06 AC 18 ms
8,592 KB
testcase_07 AC 18 ms
8,620 KB
testcase_08 AC 140 ms
31,244 KB
testcase_09 AC 160 ms
31,836 KB
testcase_10 AC 162 ms
29,436 KB
testcase_11 AC 162 ms
29,704 KB
testcase_12 AC 169 ms
31,796 KB
testcase_13 AC 165 ms
31,772 KB
testcase_14 AC 171 ms
30,384 KB
testcase_15 AC 167 ms
30,448 KB
testcase_16 AC 162 ms
30,404 KB
testcase_17 AC 165 ms
30,496 KB
testcase_18 AC 166 ms
30,484 KB
testcase_19 AC 165 ms
30,380 KB
testcase_20 AC 164 ms
32,548 KB
testcase_21 AC 163 ms
30,404 KB
testcase_22 AC 164 ms
30,512 KB
testcase_23 AC 164 ms
30,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
N=int(input())
S=input()
*A,=map(int,input().split())

cs = [0]
for i in range(N):
    if S[i] == "B":
        A[i] = -A[i]
    cs.append(cs[-1] + A[i])
print(abs(max(cs) - min(cs)))
0