結果

問題 No.999 てん vs. ほむ
ユーザー nohakai3nohakai3
提出日時 2022-11-12 13:02:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 233 bytes
コンパイル時間 1,016 ms
コンパイル使用メモリ 86,784 KB
実行使用メモリ 113,508 KB
最終ジャッジ日時 2023-10-12 04:52:35
合計ジャッジ時間 6,212 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,124 KB
testcase_01 AC 75 ms
71,316 KB
testcase_02 AC 76 ms
71,312 KB
testcase_03 AC 77 ms
71,440 KB
testcase_04 AC 75 ms
71,316 KB
testcase_05 AC 77 ms
71,264 KB
testcase_06 AC 77 ms
71,128 KB
testcase_07 AC 75 ms
71,296 KB
testcase_08 AC 84 ms
76,440 KB
testcase_09 AC 137 ms
108,856 KB
testcase_10 AC 94 ms
85,480 KB
testcase_11 AC 87 ms
81,660 KB
testcase_12 AC 101 ms
92,296 KB
testcase_13 AC 142 ms
113,308 KB
testcase_14 AC 142 ms
113,016 KB
testcase_15 AC 142 ms
113,288 KB
testcase_16 AC 142 ms
113,508 KB
testcase_17 AC 120 ms
109,396 KB
testcase_18 AC 119 ms
108,680 KB
testcase_19 AC 120 ms
109,396 KB
testcase_20 AC 123 ms
109,464 KB
testcase_21 AC 138 ms
112,788 KB
testcase_22 AC 139 ms
112,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools 
n=int(input())
A=list(map(int,input().split()))
ah=[]
for i in range(n):
    ah.append(A[2*i]-A[2*i+1])

ac=[0]+list(itertools.accumulate(ah))

ans=0
for i in range(n+1):
    ans=max(ans,-ac[-1]+ac[i]*2)

print(ans)
0