結果

問題 No.999 てん vs. ほむ
ユーザー maguchi_p_qmaguchi_p_q
提出日時 2020-02-28 21:34:50
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 123 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 32,524 KB
最終ジャッジ日時 2024-10-13 16:59:21
合計ジャッジ時間 3,744 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

N = int(input())
A = [int(zz) for zz in input().split()]

A = [A[2*i]-A[2*i+1] for i in range(N)]

li_left = [0] + list(accumulate(A))
li_right = list(accumulate(A[::-1]))[::-1] + [0]

ans = 0
for i in range(N+1):
    ans = max(ans,li_left[i]-li_right[i])

print(ans)
0