結果

問題 No.999 てん vs. ほむ
ユーザー maguchi_p_qmaguchi_p_q
提出日時 2020-02-28 21:34:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 216 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 32,644 KB
最終ジャッジ日時 2024-04-21 18:04:27
合計ジャッジ時間 3,853 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,624 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 33 ms
10,752 KB
testcase_03 AC 33 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 31 ms
10,880 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 32 ms
10,624 KB
testcase_08 AC 36 ms
11,520 KB
testcase_09 AC 196 ms
30,948 KB
testcase_10 AC 79 ms
16,540 KB
testcase_11 AC 64 ms
14,832 KB
testcase_12 AC 103 ms
19,548 KB
testcase_13 AC 214 ms
32,644 KB
testcase_14 AC 215 ms
32,520 KB
testcase_15 AC 216 ms
32,520 KB
testcase_16 AC 214 ms
32,520 KB
testcase_17 AC 191 ms
29,148 KB
testcase_18 AC 186 ms
28,704 KB
testcase_19 AC 189 ms
28,996 KB
testcase_20 AC 190 ms
29,156 KB
testcase_21 AC 183 ms
32,492 KB
testcase_22 AC 176 ms
31,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate

N = int(input())
A = [int(zz) for zz in input().split()]

A = [A[2*i]-A[2*i+1] for i in range(N)]

li_left = [0] + list(accumulate(A))
li_right = list(accumulate(A[::-1]))[::-1] + [0]

ans = 0
for i in range(N+1):
    ans = max(ans,li_left[i]-li_right[i])

print(ans)
0