結果
問題 |
No.1375 Divide and Update
|
ユーザー |
|
提出日時 | 2021-04-03 03:31:32 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 166 ms / 2,000 ms |
コード長 | 553 bytes |
コンパイル時間 | 492 ms |
コンパイル使用メモリ | 82,396 KB |
実行使用メモリ | 133,516 KB |
最終ジャッジ日時 | 2024-12-24 03:55:10 |
合計ジャッジ時間 | 5,387 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
import sys input = sys.stdin.readline N, X, Y = map(int, input().split()) a = list(map(int, input().split())) s = sum(a) xa = [X-ai for ai in a] now = 0 m = 0 xM = [] for i in range(N): now += xa[i] xM.append(now-m) m = min(now, m) for i in range(1, N): xM[i] = max(xM[i], xM[i-1]) ya = [Y-ai for ai in a] ya.reverse() now = 0 m = 0 yM = [] for i in range(N): now += ya[i] yM.append(now-m) m = min(now, m) for i in range(1, N): yM[i] = max(yM[i], yM[i-1]) for M in range(1, N-1): print(s+xM[M-1]+yM[N-M-2])