結果

問題 No.999 てん vs. ほむ
ユーザー O2MTO2MT
提出日時 2020-12-15 00:59:22
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 302 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 81,796 KB
実行使用メモリ 114,112 KB
最終ジャッジ日時 2023-10-20 05:32:45
合計ジャッジ時間 4,799 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,440 KB
testcase_01 AC 37 ms
53,376 KB
testcase_02 AC 37 ms
53,440 KB
testcase_03 AC 37 ms
53,440 KB
testcase_04 AC 36 ms
53,440 KB
testcase_05 AC 36 ms
53,440 KB
testcase_06 AC 36 ms
53,440 KB
testcase_07 AC 37 ms
53,440 KB
testcase_08 AC 44 ms
62,240 KB
testcase_09 AC 94 ms
103,852 KB
testcase_10 AC 56 ms
79,360 KB
testcase_11 AC 51 ms
73,164 KB
testcase_12 AC 64 ms
87,924 KB
testcase_13 AC 108 ms
110,952 KB
testcase_14 AC 109 ms
110,948 KB
testcase_15 AC 106 ms
110,960 KB
testcase_16 AC 105 ms
110,940 KB
testcase_17 WA -
testcase_18 AC 89 ms
112,644 KB
testcase_19 WA -
testcase_20 AC 90 ms
113,232 KB
testcase_21 AC 102 ms
110,548 KB
testcase_22 AC 93 ms
106,736 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
N = int(input())
A = list(map(int,input().split()))
if N == 1:
    print(max(A)-min(A))
    exit()
B = []
for i in range(0,2*N-1,2):
    B.append(A[i]-A[i+1])

BC = list(accumulate(B))
ans = 0

for i in range(len(BC)):
    ans = max(ans,BC[i]-(BC[-1]-BC[i]))
print(ans)
0