結果

問題 No.999 てん vs. ほむ
ユーザー 👑 H20H20
提出日時 2020-11-18 10:05:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 242 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 87,192 KB
実行使用メモリ 112,768 KB
最終ジャッジ日時 2023-09-30 14:52:14
合計ジャッジ時間 5,215 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,172 KB
testcase_01 AC 70 ms
71,496 KB
testcase_02 AC 70 ms
71,364 KB
testcase_03 AC 69 ms
71,272 KB
testcase_04 AC 71 ms
71,440 KB
testcase_05 AC 70 ms
71,180 KB
testcase_06 AC 70 ms
71,556 KB
testcase_07 AC 69 ms
71,296 KB
testcase_08 AC 77 ms
76,576 KB
testcase_09 AC 131 ms
108,516 KB
testcase_10 AC 88 ms
85,464 KB
testcase_11 AC 84 ms
81,312 KB
testcase_12 AC 96 ms
92,164 KB
testcase_13 AC 137 ms
112,632 KB
testcase_14 AC 136 ms
112,768 KB
testcase_15 AC 136 ms
112,408 KB
testcase_16 AC 135 ms
112,528 KB
testcase_17 WA -
testcase_18 AC 116 ms
108,788 KB
testcase_19 WA -
testcase_20 AC 117 ms
109,664 KB
testcase_21 AC 131 ms
112,320 KB
testcase_22 AC 131 ms
111,940 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 = list(itertools.accumulate(AH))
 
ans = 0
for i in range(N):
    ans = max(ans,-AC[-1]+AC[i]*2)
 
print(ans)
0