結果

問題 No.1375 Divide and Update
ユーザー あかしあみどりあかしあみどり
提出日時 2023-03-17 21:49:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 175 ms / 2,000 ms
コード長 684 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 81,752 KB
実行使用メモリ 140,176 KB
最終ジャッジ日時 2023-10-18 14:23:30
合計ジャッジ時間 5,968 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,468 KB
testcase_01 AC 37 ms
53,468 KB
testcase_02 AC 37 ms
53,468 KB
testcase_03 AC 37 ms
53,468 KB
testcase_04 AC 37 ms
53,468 KB
testcase_05 AC 37 ms
53,468 KB
testcase_06 AC 36 ms
53,468 KB
testcase_07 AC 37 ms
53,468 KB
testcase_08 AC 38 ms
53,468 KB
testcase_09 AC 37 ms
53,468 KB
testcase_10 AC 157 ms
110,056 KB
testcase_11 AC 140 ms
106,212 KB
testcase_12 AC 105 ms
102,896 KB
testcase_13 AC 107 ms
97,800 KB
testcase_14 AC 170 ms
135,972 KB
testcase_15 AC 166 ms
135,956 KB
testcase_16 AC 175 ms
135,988 KB
testcase_17 AC 173 ms
136,000 KB
testcase_18 AC 151 ms
135,944 KB
testcase_19 AC 150 ms
135,948 KB
testcase_20 AC 143 ms
140,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def oi(): return int(input())
def os(): return input()
def mi(): return list(map(int, input().split()))

# import sys
# input = sys.stdin.readline
# import sys
# sys.setrecursionlimit(10**8)
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
input_count = 0

input_count = 0
N,X,Y = mi()
A = mi()
def calcList(A, NUM):
    acc = NUM-A[0]
    R = [NUM-A[0]]
    mins = min(0, NUM-A[0])
    maxs = NUM-A[0]
    for a in A[1:]:
        acc += (NUM-a)
        maxs = max(maxs, acc - mins)
        R.append(maxs)
        mins = min(mins, acc)

    return R
R = calcList(A,X)
L = calcList(A[::-1], Y)
L = L[::-1]
sums = sum(A)
for l, r in zip(L[2:],R[:-2]):
    print(l+r+sums)
0