結果
問題 |
No.1433 Two color sequence
|
ユーザー |
![]() |
提出日時 | 2020-12-15 21:17:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 260 bytes |
コンパイル時間 | 131 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 33,400 KB |
最終ジャッジ日時 | 2024-09-20 05:13:08 |
合計ジャッジ時間 | 7,591 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 2 |
other | AC * 12 WA * 9 |
ソースコード
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)