結果

問題 No.1433 Two color sequence
ユーザー marroncastlemarroncastle
提出日時 2021-03-19 22:26:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 211 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 117,248 KB
最終ジャッジ日時 2024-04-29 17:30:59
合計ジャッジ時間 4,104 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,968 KB
testcase_01 AC 44 ms
51,456 KB
testcase_02 AC 42 ms
51,968 KB
testcase_03 AC 106 ms
117,248 KB
testcase_04 AC 103 ms
117,120 KB
testcase_05 AC 39 ms
51,712 KB
testcase_06 AC 40 ms
51,456 KB
testcase_07 AC 39 ms
51,968 KB
testcase_08 AC 118 ms
113,700 KB
testcase_09 AC 124 ms
114,220 KB
testcase_10 AC 123 ms
113,544 KB
testcase_11 AC 125 ms
113,732 KB
testcase_12 AC 126 ms
114,588 KB
testcase_13 AC 129 ms
114,348 KB
testcase_14 AC 128 ms
114,540 KB
testcase_15 AC 127 ms
114,020 KB
testcase_16 AC 127 ms
114,164 KB
testcase_17 AC 129 ms
114,020 KB
testcase_18 AC 127 ms
114,276 KB
testcase_19 AC 127 ms
114,908 KB
testcase_20 AC 127 ms
114,668 KB
testcase_21 AC 129 ms
114,144 KB
testcase_22 AC 124 ms
114,696 KB
testcase_23 AC 124 ms
114,404 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
A = list(map(int, input().split()))
for i in range(N):
  if S[i]=='B':
    A[i] *= -1
from itertools import groupby, accumulate, product, permutations, combinations
cum = [0]+list(accumulate(A))
print(max(cum)-min(cum))
0