結果

問題 No.999 てん vs. ほむ
ユーザー tktk_snsn
提出日時 2021-04-28 01:24:25
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 139 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 32,636 KB
最終ジャッジ日時 2024-07-06 20:44:33
合計ジャッジ時間 3,658 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N = int(input())
A = list(map(int, input().split()))

ans = sum(A[0::2]) - sum(A[1::2])
tmp = ans
while A:
    x = A.pop() - A.pop()
    tmp += 2 * x
    ans = max(ans, tmp)

print(ans)
0