結果

問題 No.999 てん vs. ほむ
ユーザー tktk_snsntktk_snsn
提出日時 2021-04-28 01:24:25
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 149 ms / 2,000 ms
コード長 216 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 10,692 KB
実行使用メモリ 30,428 KB
最終ジャッジ日時 2023-09-21 02:00:27
合計ジャッジ時間 3,251 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
8,540 KB
testcase_01 AC 18 ms
8,588 KB
testcase_02 AC 17 ms
8,404 KB
testcase_03 AC 18 ms
8,584 KB
testcase_04 AC 19 ms
8,456 KB
testcase_05 AC 19 ms
8,492 KB
testcase_06 AC 19 ms
8,472 KB
testcase_07 AC 17 ms
8,624 KB
testcase_08 AC 22 ms
9,248 KB
testcase_09 AC 135 ms
28,816 KB
testcase_10 AC 53 ms
14,472 KB
testcase_11 AC 42 ms
12,392 KB
testcase_12 AC 70 ms
17,524 KB
testcase_13 AC 149 ms
30,236 KB
testcase_14 AC 146 ms
30,184 KB
testcase_15 AC 148 ms
30,312 KB
testcase_16 AC 149 ms
30,216 KB
testcase_17 AC 133 ms
29,620 KB
testcase_18 AC 128 ms
29,456 KB
testcase_19 AC 132 ms
29,588 KB
testcase_20 AC 134 ms
29,880 KB
testcase_21 AC 137 ms
30,428 KB
testcase_22 AC 132 ms
29,536 KB
権限があれば一括ダウンロードができます

ソースコード

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