結果

問題 No.999 てん vs. ほむ
コンテスト
ユーザー Ohnuma
提出日時 2020-04-07 15:09:41
言語 Python3
(3.15.0 + numpy 2.5.4 + scipy 1.18.1 + ACL)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 407 ms / 2,000 ms
+ 727µs
コード長 328 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 56 ms
コンパイル使用メモリ 15,104 KB
実行使用メモリ 53,596 KB
最終ジャッジ日時 2026-10-12 05:02:55
合計ジャッジ時間 11,455 ms
ジャッジサーバーID
(参考情報)
judge1_1 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import numpy as np
n = int(input())
A = list(map(int,input().split()))
L = [a for a in A[::2]]
R = [a for a in A[1::2]]
cumL = np.cumsum(L)
cumR = np.cumsum(R)
sumA = sum(A)
ans = 0
ans = max(cumL[-1], cumR[-1])*2 - sumA
for i in range(n):
    h = cumL[i] + cumR[-1] - cumR[i]
    t = sumA - h
    ans = max(ans, h-t)
print(ans)
0