結果
| 問題 |
No.1375 Divide and Update
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-17 21:49:11 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 182 ms / 2,000 ms |
| コード長 | 684 bytes |
| コンパイル時間 | 419 ms |
| コンパイル使用メモリ | 82,472 KB |
| 実行使用メモリ | 140,288 KB |
| 最終ジャッジ日時 | 2024-09-18 10:39:29 |
| 合計ジャッジ時間 | 6,171 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 19 |
ソースコード
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)