結果

問題 No.1433 Two color sequence
ユーザー 👑 H20H20
提出日時 2021-04-10 16:45:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 220 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 86,836 KB
実行使用メモリ 119,516 KB
最終ジャッジ日時 2023-09-08 12:39:21
合計ジャッジ時間 6,692 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,456 KB
testcase_01 AC 75 ms
71,468 KB
testcase_02 AC 74 ms
71,444 KB
testcase_03 AC 137 ms
110,608 KB
testcase_04 AC 123 ms
109,796 KB
testcase_05 AC 75 ms
71,280 KB
testcase_06 AC 74 ms
71,464 KB
testcase_07 AC 72 ms
71,440 KB
testcase_08 AC 141 ms
119,516 KB
testcase_09 AC 147 ms
118,564 KB
testcase_10 AC 145 ms
116,412 KB
testcase_11 AC 147 ms
116,360 KB
testcase_12 AC 147 ms
118,568 KB
testcase_13 AC 150 ms
118,556 KB
testcase_14 AC 147 ms
118,688 KB
testcase_15 AC 148 ms
118,604 KB
testcase_16 AC 146 ms
118,704 KB
testcase_17 AC 148 ms
118,540 KB
testcase_18 AC 146 ms
118,724 KB
testcase_19 AC 145 ms
118,624 KB
testcase_20 AC 146 ms
118,604 KB
testcase_21 AC 148 ms
118,528 KB
testcase_22 AC 147 ms
118,636 KB
testcase_23 AC 147 ms
118,536 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
N = int(input())
S = input()
A = list(map(int, input().split()))
for i in range(N):
    if S[i]=='B':
        A[i]*=-1
AC = list(itertools.accumulate(A)) + [0]
mi = min(AC)
ma = max(AC)
print(abs(mi-ma))
0