結果

問題 No.999 てん vs. ほむ
ユーザー 👑 H20H20
提出日時 2020-11-18 10:14:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 248 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 86,948 KB
実行使用メモリ 113,680 KB
最終ジャッジ日時 2023-09-30 14:52:25
合計ジャッジ時間 3,903 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,516 KB
testcase_01 AC 73 ms
71,340 KB
testcase_02 AC 72 ms
71,392 KB
testcase_03 AC 74 ms
71,532 KB
testcase_04 AC 73 ms
71,392 KB
testcase_05 AC 73 ms
71,352 KB
testcase_06 AC 73 ms
71,496 KB
testcase_07 AC 71 ms
71,476 KB
testcase_08 AC 81 ms
76,552 KB
testcase_09 AC 132 ms
109,028 KB
testcase_10 AC 89 ms
85,904 KB
testcase_11 AC 85 ms
81,612 KB
testcase_12 AC 98 ms
92,260 KB
testcase_13 AC 139 ms
113,192 KB
testcase_14 AC 138 ms
113,364 KB
testcase_15 AC 138 ms
113,364 KB
testcase_16 AC 137 ms
113,680 KB
testcase_17 AC 119 ms
109,780 KB
testcase_18 AC 118 ms
108,896 KB
testcase_19 AC 121 ms
109,752 KB
testcase_20 AC 120 ms
109,752 KB
testcase_21 AC 138 ms
112,976 KB
testcase_22 AC 135 ms
112,980 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