結果

問題 No.999 てん vs. ほむ
ユーザー yomo3
提出日時 2020-03-07 03:24:46
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 111 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 33,392 KB
最終ジャッジ日時 2024-10-14 11:07:38
合計ジャッジ時間 4,962 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

N = int(input())
A = list(map(int, input().split()))

ae = list(accumulate([0] + A[0::2]))
ao = list(accumulate([0] + A[1::2]))

ans = -10**17
for i in range(N+1):
    homu = ae[i] - ae[0] + ao[N] - ao[i]
    ten = ao[i] - ao[0] + ae[N] - ae[i]
    s = homu - ten
    if s > ans: ans = s
print(ans)
0