結果

問題 No.1433 Two color sequence
ユーザー marroncastlemarroncastle
提出日時 2021-03-19 22:26:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 450 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 118,072 KB
最終ジャッジ日時 2023-08-12 02:54:31
合計ジャッジ時間 4,824 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 69 ms
71,224 KB
testcase_01 AC 69 ms
71,224 KB
testcase_02 AC 69 ms
71,260 KB
testcase_03 AC 124 ms
110,616 KB
testcase_04 AC 117 ms
109,844 KB
testcase_05 AC 68 ms
71,636 KB
testcase_06 AC 68 ms
71,528 KB
testcase_07 AC 69 ms
71,660 KB
testcase_08 AC 135 ms
118,072 KB
testcase_09 AC 142 ms
117,156 KB
testcase_10 AC 138 ms
115,008 KB
testcase_11 AC 140 ms
114,988 KB
testcase_12 AC 142 ms
117,392 KB
testcase_13 AC 142 ms
117,312 KB
testcase_14 AC 142 ms
117,120 KB
testcase_15 AC 145 ms
117,068 KB
testcase_16 AC 143 ms
117,288 KB
testcase_17 AC 140 ms
117,308 KB
testcase_18 AC 141 ms
117,472 KB
testcase_19 AC 141 ms
117,124 KB
testcase_20 AC 142 ms
117,256 KB
testcase_21 AC 138 ms
117,252 KB
testcase_22 AC 140 ms
117,120 KB
testcase_23 AC 142 ms
117,084 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