結果
問題 |
No.1433 Two color sequence
|
ユーザー |
|
提出日時 | 2021-12-13 01:51:40 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 102 ms / 2,000 ms |
コード長 | 288 bytes |
コンパイル時間 | 178 ms |
コンパイル使用メモリ | 82,376 KB |
実行使用メモリ | 102,016 KB |
最終ジャッジ日時 | 2024-07-21 15:28:25 |
合計ジャッジ時間 | 4,272 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
n = int(input()) S = input() A = list(map(int, input().split())) for i in range(n): if S[i] == "R": A[i] *= -1 tot = 0 max_ = 0 min_ = 0 ans = 0 for a in A: tot += a min_ = min(min_, tot) max_ = max(max_, tot) ans = max(ans, max_ - tot, tot - min_) print(ans)