結果
| 問題 | No.1433 Two color sequence | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2021-03-19 22:26:36 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 131 ms / 2,000 ms | 
| コード長 | 248 bytes | 
| コンパイル時間 | 405 ms | 
| コンパイル使用メモリ | 82,176 KB | 
| 実行使用メモリ | 117,504 KB | 
| 最終ジャッジ日時 | 2024-11-18 23:13:15 | 
| 合計ジャッジ時間 | 4,175 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 21 | 
ソースコード
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))
            
            
            
        