結果
問題 | No.1433 Two color sequence |
ユーザー |
![]() |
提出日時 | 2021-03-20 05:40:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 535 ms / 2,000 ms |
コード長 | 375 bytes |
コンパイル時間 | 260 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 33,984 KB |
最終ジャッジ日時 | 2024-11-20 07:25:08 |
合計ジャッジ時間 | 12,122 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 |
ソースコード
from itertools import accumulateN = int(input())S = input()a = list(map(int, input().split()))for i in range(N):if S[i] == 'R':continuea[i] = -a[i]result = 0minv = 0maxv = 0for v in list(accumulate(a)):result = max(result, abs(v - minv))result = max(result, abs(v - maxv))minv = min(minv, v)maxv = max(maxv, v)print(result)