結果

問題 No.1375 Divide and Update
ユーザー tempura_pptempura_pp
提出日時 2019-03-24 03:52:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 583 ms / 2,000 ms
コード長 720 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,652 KB
最終ジャッジ日時 2024-04-10 06:49:01
合計ジャッジ時間 8,194 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 31 ms
10,880 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,880 KB
testcase_05 AC 28 ms
10,752 KB
testcase_06 AC 29 ms
10,752 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 AC 28 ms
10,880 KB
testcase_10 AC 508 ms
30,028 KB
testcase_11 AC 474 ms
32,056 KB
testcase_12 AC 268 ms
20,432 KB
testcase_13 AC 228 ms
18,620 KB
testcase_14 AC 570 ms
32,864 KB
testcase_15 AC 577 ms
32,680 KB
testcase_16 AC 564 ms
32,804 KB
testcase_17 AC 564 ms
32,680 KB
testcase_18 AC 583 ms
32,612 KB
testcase_19 AC 565 ms
32,612 KB
testcase_20 AC 543 ms
34,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve() :
    n,x,y=map(int,input().split())
    if n<2 or n>200000 or x<0 or x>1000000000 or y<0 or y>1000000000 :
        print("waaaaaa")
    a = list(map(int, input().split()))
    if len(a) != n : 
        print("hogeeeeeee")
    for i in a : 
        if i<0 or i >1000000000 :
            print("guaaaaaaa")
    inf = 1000000007
    dp1 = [-inf]*(n+1)
    dp2=[-inf]*(n+1)
    cur = -inf
    for i in range(n) : 
        cur = max(x-a[i], x-a[i]+cur)
        dp1[i+1] = max(dp1[i],cur)
    cur=-inf
    for i in range(n-1,-1,-1) :
        cur = max(y-a[i], y-a[i]+cur)
        dp2[i] = max(dp2[i+1],cur)
    sum = 0
    for i in a : sum+=i
    for i in range(n-2) :
        print(sum+dp1[i+1]+dp2[i+2])
solve()
0