結果

問題 No.1433 Two color sequence
ユーザー 小野寺健小野寺健
提出日時 2021-05-19 12:51:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 419 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 91 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 33,064 KB
最終ジャッジ日時 2024-04-17 23:18:54
合計ジャッジ時間 8,556 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,624 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 26 ms
10,624 KB
testcase_03 AC 351 ms
14,468 KB
testcase_04 AC 351 ms
14,512 KB
testcase_05 AC 27 ms
10,752 KB
testcase_06 AC 26 ms
10,624 KB
testcase_07 AC 24 ms
10,752 KB
testcase_08 AC 383 ms
32,876 KB
testcase_09 AC 394 ms
33,064 KB
testcase_10 AC 384 ms
31,644 KB
testcase_11 AC 390 ms
31,792 KB
testcase_12 AC 410 ms
32,468 KB
testcase_13 AC 415 ms
32,472 KB
testcase_14 AC 406 ms
32,864 KB
testcase_15 AC 406 ms
32,736 KB
testcase_16 AC 400 ms
32,728 KB
testcase_17 AC 414 ms
32,856 KB
testcase_18 AC 419 ms
32,984 KB
testcase_19 AC 406 ms
32,860 KB
testcase_20 AC 418 ms
32,724 KB
testcase_21 AC 411 ms
32,856 KB
testcase_22 AC 405 ms
32,732 KB
testcase_23 AC 401 ms
32,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
S = input()
A = list(map(int, input().split()))

res = 0
maxs, mins = 0, 0
for i in range(N):
    v = A[i] if S[i] == 'R' else -A[i]
    maxs = max(maxs + v, v)
    mins = min(mins + v, v)
    res = max(res, abs(maxs), abs(mins))
        
print(res)
0