結果

問題 No.1375 Divide and Update
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-02-27 15:21:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 477 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 110,592 KB
最終ジャッジ日時 2024-04-10 15:40:36
合計ジャッジ時間 5,182 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
51,840 KB
testcase_01 AC 40 ms
52,096 KB
testcase_02 AC 38 ms
52,224 KB
testcase_03 AC 38 ms
52,352 KB
testcase_04 AC 38 ms
52,224 KB
testcase_05 AC 39 ms
51,968 KB
testcase_06 AC 39 ms
52,096 KB
testcase_07 AC 38 ms
52,096 KB
testcase_08 AC 38 ms
51,968 KB
testcase_09 AC 37 ms
52,072 KB
testcase_10 AC 133 ms
106,752 KB
testcase_11 AC 138 ms
106,072 KB
testcase_12 AC 100 ms
91,904 KB
testcase_13 AC 99 ms
89,508 KB
testcase_14 AC 154 ms
105,772 KB
testcase_15 AC 151 ms
106,088 KB
testcase_16 AC 152 ms
106,100 KB
testcase_17 AC 148 ms
105,760 KB
testcase_18 AC 148 ms
105,792 KB
testcase_19 AC 149 ms
105,724 KB
testcase_20 AC 130 ms
110,592 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