結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 29 ms
10,880 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 29 ms
10,880 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 33 ms
11,648 KB
testcase_09 AC 127 ms
30,936 KB
testcase_10 AC 58 ms
16,660 KB
testcase_11 AC 48 ms
14,856 KB
testcase_12 AC 71 ms
19,552 KB
testcase_13 AC 139 ms
32,608 KB
testcase_14 AC 137 ms
32,620 KB
testcase_15 AC 138 ms
32,644 KB
testcase_16 AC 139 ms
32,640 KB
testcase_17 AC 122 ms
29,520 KB
testcase_18 AC 121 ms
29,228 KB
testcase_19 AC 126 ms
29,324 KB
testcase_20 AC 127 ms
29,260 KB
testcase_21 AC 132 ms
32,612 KB
testcase_22 AC 133 ms
31,620 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 = ao[-1] - ae[-1] + 2 * max(ae[i] - ao[i] for i in range(N+1))
print(ans)
0