結果

問題 No.1375 Divide and Update
ユーザー Kiri8128Kiri8128
提出日時 2021-02-05 23:06:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 121,324 KB
最終ジャッジ日時 2023-09-15 10:39:14
合計ジャッジ時間 5,361 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,352 KB
testcase_01 AC 72 ms
71,180 KB
testcase_02 AC 71 ms
71,420 KB
testcase_03 AC 74 ms
71,116 KB
testcase_04 AC 73 ms
71,120 KB
testcase_05 AC 72 ms
71,216 KB
testcase_06 AC 72 ms
71,188 KB
testcase_07 AC 73 ms
71,232 KB
testcase_08 AC 72 ms
71,320 KB
testcase_09 AC 73 ms
71,184 KB
testcase_10 AC 170 ms
103,956 KB
testcase_11 AC 160 ms
101,068 KB
testcase_12 AC 130 ms
96,068 KB
testcase_13 AC 125 ms
93,752 KB
testcase_14 AC 186 ms
117,424 KB
testcase_15 AC 186 ms
117,200 KB
testcase_16 AC 182 ms
117,132 KB
testcase_17 AC 180 ms
117,456 KB
testcase_18 AC 181 ms
117,432 KB
testcase_19 AC 184 ms
117,232 KB
testcase_20 AC 161 ms
121,324 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X, Y = map(int, input().split())
A = [int(a) for a in input().split()]
S = sum(A)
B, C = [], []
s = 0
mi = 0
ma = -10 ** 9
for a in A:
    s += X - a
    ma = max(ma, s - mi)
    B.append(ma)
    mi = min(mi, s)
s = 0
mi = 0
ma = -10 ** 9
for a in A[::-1]:
    s += Y - a
    ma = max(ma, s - mi)
    C.append(ma)
    mi = min(mi, s)
for i in range(N - 2):
    print(B[i] + C[N-3-i] + S)
0