結果

問題 No.1433 Two color sequence
ユーザー shacklebolt-codeshacklebolt-code
提出日時 2021-03-19 22:52:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 217 ms / 2,000 ms
コード長 206 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 34,820 KB
最終ジャッジ日時 2024-04-29 18:16:18
合計ジャッジ時間 5,173 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,624 KB
testcase_01 AC 29 ms
10,624 KB
testcase_02 AC 35 ms
10,624 KB
testcase_03 AC 167 ms
15,784 KB
testcase_04 AC 165 ms
15,784 KB
testcase_05 AC 31 ms
10,624 KB
testcase_06 AC 34 ms
10,368 KB
testcase_07 AC 30 ms
10,624 KB
testcase_08 AC 206 ms
34,820 KB
testcase_09 AC 202 ms
34,284 KB
testcase_10 AC 197 ms
32,944 KB
testcase_11 AC 198 ms
33,096 KB
testcase_12 AC 210 ms
33,816 KB
testcase_13 AC 206 ms
33,952 KB
testcase_14 AC 210 ms
34,224 KB
testcase_15 AC 209 ms
34,096 KB
testcase_16 AC 209 ms
34,216 KB
testcase_17 AC 210 ms
34,224 KB
testcase_18 AC 209 ms
34,092 KB
testcase_19 AC 217 ms
34,088 KB
testcase_20 AC 210 ms
34,684 KB
testcase_21 AC 210 ms
34,096 KB
testcase_22 AC 215 ms
34,200 KB
testcase_23 AC 216 ms
33,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = list(input())
L = [0]
A = list(map(int, input().split()))
for i in range(N):
    if S[i] == 'R':
        L += [L[-1] + A[i]]
    else:
        L += [L[-1] - A[i]]
print(max(L) - min(L))
0