結果

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

テストケース

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

ソースコード

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
mi=0
for i in range(1, n+1):
  ans = max(ans, x[i]-mi)
  mi = min(x[i], mi)
print(ans)
0