結果

問題 No.999 てん vs. ほむ
ユーザー takakintakakin
提出日時 2020-04-30 21:34:53
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 205 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 323 ms
コンパイル使用メモリ 10,904 KB
実行使用メモリ 30,624 KB
最終ジャッジ日時 2023-08-22 17:56:07
合計ジャッジ時間 4,887 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,848 KB
testcase_01 AC 15 ms
7,896 KB
testcase_02 AC 14 ms
7,824 KB
testcase_03 AC 14 ms
7,848 KB
testcase_04 AC 15 ms
7,800 KB
testcase_05 AC 15 ms
7,848 KB
testcase_06 AC 14 ms
7,848 KB
testcase_07 AC 15 ms
7,768 KB
testcase_08 AC 20 ms
8,764 KB
testcase_09 AC 184 ms
28,324 KB
testcase_10 AC 65 ms
14,240 KB
testcase_11 AC 46 ms
12,772 KB
testcase_12 AC 89 ms
17,212 KB
testcase_13 AC 204 ms
29,952 KB
testcase_14 AC 203 ms
29,940 KB
testcase_15 AC 204 ms
29,872 KB
testcase_16 AC 205 ms
30,012 KB
testcase_17 AC 181 ms
30,624 KB
testcase_18 AC 182 ms
29,132 KB
testcase_19 AC 182 ms
29,316 KB
testcase_20 AC 186 ms
29,432 KB
testcase_21 AC 195 ms
29,832 KB
testcase_22 AC 190 ms
29,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
A=[int(i) for i in input().split()]
E,O=[0],[0]
for i in range(n):
  E.append(E[-1]+A[2*i])
  O.append(O[-1]+A[2*i+1])
eo=E[-1]
oo=O[-1]
ans=oo-eo
for i in range(n):
  ans=max(ans,oo-eo+2*E[i+1]-2*O[i+1])
print(ans)
0