結果

問題 No.1375 Divide and Update
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-02-27 15:21:52
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 557 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 111,236 KB
最終ジャッジ日時 2023-07-26 01:20:17
合計ジャッジ時間 9,508 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,304 KB
testcase_01 AC 73 ms
71,420 KB
testcase_02 AC 73 ms
71,424 KB
testcase_03 AC 74 ms
71,300 KB
testcase_04 AC 74 ms
71,332 KB
testcase_05 AC 73 ms
71,296 KB
testcase_06 AC 72 ms
71,472 KB
testcase_07 AC 73 ms
71,580 KB
testcase_08 AC 73 ms
71,360 KB
testcase_09 AC 74 ms
71,348 KB
testcase_10 AC 179 ms
103,456 KB
testcase_11 AC 160 ms
104,044 KB
testcase_12 AC 127 ms
92,512 KB
testcase_13 AC 127 ms
90,248 KB
testcase_14 AC 185 ms
107,176 KB
testcase_15 AC 183 ms
107,328 KB
testcase_16 AC 184 ms
107,188 KB
testcase_17 AC 183 ms
107,004 KB
testcase_18 AC 181 ms
109,208 KB
testcase_19 AC 178 ms
109,276 KB
testcase_20 AC 160 ms
111,236 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dpl = [0]*n
dplf = [0]*n

now = 0
for i in range(n):
    dpl[i] = max(dpl[i-1]+x,now+x)
    dplf[i] = max(dplf[i-1]+A[i],dpl[i])
    now += A[i]
    dplf[0] = dpl[0]

dpr = [0]*(n+1)
dprf = [0]*(n+1)
now = 0
for i in range(n)[::-1]:
    dpr[i] = max(dpr[i+1]+y,now+y)
    dprf[i] = max(dprf[i+1]+A[i],dpr[i])
    now += A[i]
    dprf[-2] = dpr[-2]

for i in range(1,n-1):
    print(dplf[i-1]+A[i]+dprf[i+1])
0