結果

問題 No.999 てん vs. ほむ
ユーザー sho_00sho_00
提出日時 2020-04-09 09:02:48
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 309 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,668 KB
実行使用メモリ 30,676 KB
最終ジャッジ日時 2023-09-28 12:16:25
合計ジャッジ時間 4,584 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,848 KB
testcase_01 AC 16 ms
7,864 KB
testcase_02 AC 16 ms
7,860 KB
testcase_03 AC 16 ms
7,860 KB
testcase_04 AC 17 ms
7,824 KB
testcase_05 AC 16 ms
7,952 KB
testcase_06 AC 17 ms
7,884 KB
testcase_07 AC 16 ms
7,864 KB
testcase_08 AC 24 ms
8,704 KB
testcase_09 AC 228 ms
28,020 KB
testcase_10 AC 76 ms
14,208 KB
testcase_11 AC 56 ms
12,604 KB
testcase_12 AC 105 ms
17,164 KB
testcase_13 AC 240 ms
30,012 KB
testcase_14 AC 234 ms
29,912 KB
testcase_15 AC 239 ms
29,860 KB
testcase_16 AC 236 ms
29,876 KB
testcase_17 AC 216 ms
30,676 KB
testcase_18 AC 218 ms
29,188 KB
testcase_19 AC 218 ms
29,296 KB
testcase_20 AC 216 ms
29,480 KB
testcase_21 AC 229 ms
29,800 KB
testcase_22 AC 226 ms
28,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
odd=[0]
even=[0]
sum_a=0
for i in range(2*n):
  if i%2==0:
    odd.append(a[i]+odd[-1])
  else:
    even.append(a[i]+even[-1])
  sum_a+=a[i]
ans=0
sum_even=even[-1]
for i in range(n+1):
  score_A=odd[i]+sum_even-even[i]
  ans=max(ans,2*score_A-sum_a)
print(ans)
0