結果

問題 No.1375 Divide and Update
ユーザー 👑 rin204rin204
提出日時 2022-04-16 16:30:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 514 bytes
コンパイル時間 331 ms
コンパイル使用メモリ 86,680 KB
実行使用メモリ 113,932 KB
最終ジャッジ日時 2023-08-26 19:14:12
合計ジャッジ時間 7,911 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
70,900 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 64 ms
71,024 KB
testcase_06 AC 68 ms
71,084 KB
testcase_07 AC 64 ms
71,040 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 161 ms
109,720 KB
testcase_15 AC 163 ms
109,924 KB
testcase_16 AC 165 ms
109,840 KB
testcase_17 AC 166 ms
109,836 KB
testcase_18 AC 145 ms
111,560 KB
testcase_19 AC 152 ms
111,576 KB
testcase_20 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x, y = map(int, input().split())
A = list(map(int, input().split()))
tot = sum(A)

min_ = 0
tmp = 0
L = [0] * (n - 2)
for i, a in enumerate(A[:n-2]):
    tmp += x - a
    L[i] = tmp - min_
    if i != 0 and L[i - 1] > L[i]:
        L[i] = L[i - 1]
    min_ = min(tmp, min_)

R = [0] * (n - 2)
for i, a in enumerate(A[2:][::-1]):
    tmp += y - a
    R[i] = tmp - min_
    if i != 0 and R[i - 1] > R[i]:
        R[i] = R[i - 1]
    min_ = min(tmp, min_)

R = R[::-1]
for l, r in zip(L, R):
    print(tot + l + r)
0