結果

問題 No.999 てん vs. ほむ
ユーザー OhnumaOhnuma
提出日時 2020-04-07 14:56:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 287 bytes
コンパイル時間 80 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 51,332 KB
最終ジャッジ日時 2023-09-21 19:38:33
合計ジャッジ時間 8,517 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 134 ms
29,460 KB
testcase_01 AC 132 ms
29,456 KB
testcase_02 AC 133 ms
29,680 KB
testcase_03 AC 133 ms
29,620 KB
testcase_04 AC 135 ms
29,616 KB
testcase_05 AC 136 ms
29,500 KB
testcase_06 AC 136 ms
29,468 KB
testcase_07 AC 135 ms
29,604 KB
testcase_08 AC 140 ms
30,392 KB
testcase_09 AC 310 ms
49,844 KB
testcase_10 AC 185 ms
35,552 KB
testcase_11 AC 171 ms
33,736 KB
testcase_12 AC 211 ms
38,528 KB
testcase_13 AC 323 ms
51,144 KB
testcase_14 AC 322 ms
51,312 KB
testcase_15 AC 327 ms
51,080 KB
testcase_16 AC 324 ms
51,064 KB
testcase_17 WA -
testcase_18 AC 308 ms
50,256 KB
testcase_19 WA -
testcase_20 AC 310 ms
50,848 KB
testcase_21 AC 324 ms
51,332 KB
testcase_22 AC 317 ms
50,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np
n = int(input())
A = list(map(int,input().split()))
L = [a for a in A[::2]]
R = [a for a in A[1::2]]
cumL = np.cumsum(L)
cumR = np.cumsum(R)
sumA = sum(A)
ans = 0
for i in range(n):
    h = cumL[i] + cumR[-1]-cumR[i]
    t = sumA - h
    ans = max(ans, h-t)
print(ans)
0