結果

問題 No.1433 Two color sequence
ユーザー tyawanmusityawanmusi
提出日時 2020-12-15 21:17:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 260 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 11,892 KB
実行使用メモリ 32,812 KB
最終ジャッジ日時 2023-10-20 09:44:31
合計ジャッジ時間 6,965 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,048 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 264 ms
13,440 KB
testcase_05 WA -
testcase_06 AC 27 ms
10,048 KB
testcase_07 AC 27 ms
10,048 KB
testcase_08 WA -
testcase_09 AC 309 ms
32,316 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 308 ms
31,868 KB
testcase_13 AC 309 ms
31,872 KB
testcase_14 WA -
testcase_15 AC 309 ms
31,992 KB
testcase_16 AC 307 ms
31,992 KB
testcase_17 AC 307 ms
31,992 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 314 ms
32,600 KB
testcase_21 AC 310 ms
31,992 KB
testcase_22 AC 307 ms
31,992 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
s = input()
a = list(map(int, input().split()))
x = [0]
for i in range(n):
  if s[i] == "R":
    x.append(x[-1]+a[i])
  else:
    x.append(x[-1]-a[i])
ans=0
ma=0
for i in range(1, n+1):
  ans = max(ans, ma-x[i])
  ma = max(x[i], ma)
print(ans)
0