結果

問題 No.1433 Two color sequence
ユーザー trineutrontrineutron
提出日時 2021-03-19 21:52:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 217 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 33,336 KB
最終ジャッジ日時 2024-04-29 16:39:44
合計ジャッジ時間 4,946 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,496 KB
testcase_01 AC 32 ms
10,496 KB
testcase_02 AC 30 ms
10,496 KB
testcase_03 AC 150 ms
14,368 KB
testcase_04 AC 143 ms
14,404 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 30 ms
10,368 KB
testcase_07 AC 30 ms
10,496 KB
testcase_08 AC 186 ms
33,336 KB
testcase_09 AC 196 ms
32,592 KB
testcase_10 AC 190 ms
31,508 KB
testcase_11 AC 189 ms
31,652 KB
testcase_12 AC 194 ms
32,456 KB
testcase_13 AC 194 ms
32,464 KB
testcase_14 AC 196 ms
32,724 KB
testcase_15 AC 197 ms
32,592 KB
testcase_16 AC 194 ms
32,592 KB
testcase_17 AC 194 ms
32,716 KB
testcase_18 AC 195 ms
32,716 KB
testcase_19 AC 195 ms
32,716 KB
testcase_20 AC 191 ms
33,212 KB
testcase_21 AC 197 ms
32,716 KB
testcase_22 AC 197 ms
32,588 KB
testcase_23 AC 193 ms
32,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
a = list(map(int, input().split()))
r = [0] * (n + 1)
for i in range(n):
    if s[i] == 'R':
        r[i + 1] = r[i] + a[i]
    else:
        r[i + 1] = r[i] - a[i]
print(max(r) - min(r))
0