結果

問題 No.999 てん vs. ほむ
ユーザー yomo3yomo3
提出日時 2020-03-07 03:24:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 553 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 33,516 KB
最終ジャッジ日時 2024-04-22 11:46:43
合計ジャッジ時間 4,767 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 31 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 31 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 36 ms
11,648 KB
testcase_09 AC 195 ms
31,476 KB
testcase_10 AC 78 ms
16,664 KB
testcase_11 AC 61 ms
15,516 KB
testcase_12 AC 101 ms
19,808 KB
testcase_13 AC 209 ms
33,392 KB
testcase_14 AC 213 ms
33,384 KB
testcase_15 AC 209 ms
33,516 KB
testcase_16 AC 207 ms
33,384 KB
testcase_17 AC 194 ms
29,528 KB
testcase_18 AC 192 ms
28,932 KB
testcase_19 AC 192 ms
29,200 KB
testcase_20 AC 187 ms
29,448 KB
testcase_21 AC 201 ms
32,616 KB
testcase_22 AC 199 ms
31,760 KB
権限があれば一括ダウンロードができます

ソースコード

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