結果

問題 No.999 てん vs. ほむ
ユーザー OhnumaOhnuma
提出日時 2020-04-07 15:08:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 313 bytes
コンパイル時間 74 ms
コンパイル使用メモリ 10,920 KB
実行使用メモリ 51,372 KB
最終ジャッジ日時 2023-09-21 19:55:24
合計ジャッジ時間 9,555 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
29,612 KB
testcase_01 AC 125 ms
29,320 KB
testcase_02 AC 122 ms
29,448 KB
testcase_03 AC 123 ms
29,448 KB
testcase_04 AC 122 ms
29,352 KB
testcase_05 AC 126 ms
29,436 KB
testcase_06 AC 124 ms
29,396 KB
testcase_07 AC 123 ms
29,460 KB
testcase_08 AC 129 ms
30,160 KB
testcase_09 AC 295 ms
49,760 KB
testcase_10 AC 174 ms
35,348 KB
testcase_11 AC 163 ms
33,692 KB
testcase_12 AC 201 ms
38,460 KB
testcase_13 AC 316 ms
51,124 KB
testcase_14 AC 311 ms
51,020 KB
testcase_15 AC 310 ms
51,144 KB
testcase_16 AC 314 ms
51,372 KB
testcase_17 WA -
testcase_18 AC 290 ms
50,352 KB
testcase_19 WA -
testcase_20 AC 294 ms
51,020 KB
testcase_21 AC 307 ms
51,224 KB
testcase_22 AC 306 ms
50,468 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
ans = 2*cumL[-1] - sumA
for i in range(n):
    h = cumL[i] + cumR[-1] - cumR[i]
    t = sumA - h
    ans = max(ans, h-t)
print(ans)
0