結果

問題 No.1433 Two color sequence
ユーザー kohei2019kohei2019
提出日時 2022-05-20 00:15:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 130 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,852 KB
実行使用メモリ 128,832 KB
最終ジャッジ日時 2023-10-19 08:52:47
合計ジャッジ時間 4,970 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,444 KB
testcase_01 AC 38 ms
53,444 KB
testcase_02 AC 38 ms
53,444 KB
testcase_03 AC 102 ms
128,832 KB
testcase_04 AC 103 ms
128,832 KB
testcase_05 AC 38 ms
53,444 KB
testcase_06 AC 38 ms
53,444 KB
testcase_07 AC 39 ms
53,444 KB
testcase_08 AC 126 ms
126,216 KB
testcase_09 AC 128 ms
126,260 KB
testcase_10 AC 127 ms
125,480 KB
testcase_11 AC 129 ms
125,648 KB
testcase_12 AC 128 ms
126,256 KB
testcase_13 AC 130 ms
126,264 KB
testcase_14 AC 126 ms
126,420 KB
testcase_15 AC 125 ms
126,408 KB
testcase_16 AC 125 ms
126,320 KB
testcase_17 AC 126 ms
126,428 KB
testcase_18 AC 126 ms
126,328 KB
testcase_19 AC 126 ms
126,416 KB
testcase_20 AC 125 ms
126,324 KB
testcase_21 AC 126 ms
126,324 KB
testcase_22 AC 126 ms
126,416 KB
testcase_23 AC 125 ms
126,328 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
lsa = list(map(int,input().split()))
lsB = []
lsR = []

ll = []
for i in range(N):
    if S[i] == 'R':
        ll.append(lsa[i])
    else:
        ll.append(-lsa[i])

lssum = [0]
for i in range(N):
    lssum.append(lssum[-1]+ll[i])
print(max(lssum)-min(lssum))
0