結果

問題 No.999 てん vs. ほむ
ユーザー kimiyukikimiyuki
提出日時 2020-02-28 21:35:26
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 420 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 32,892 KB
最終ジャッジ日時 2024-04-21 18:05:34
合計ジャッジ時間 3,468 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 27 ms
10,880 KB
testcase_02 AC 27 ms
10,752 KB
testcase_03 AC 27 ms
10,752 KB
testcase_04 AC 28 ms
10,752 KB
testcase_05 WA -
testcase_06 AC 31 ms
10,880 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 60 ms
16,708 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 151 ms
32,688 KB
testcase_16 WA -
testcase_17 AC 140 ms
29,180 KB
testcase_18 WA -
testcase_19 AC 137 ms
29,160 KB
testcase_20 WA -
testcase_21 AC 139 ms
32,652 KB
testcase_22 AC 129 ms
31,976 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import math
def f(a):
    dp = [None] * (len(a) // 2 + 1)
    dp[0] = 0
    for i in range(len(a) // 2):
        dp[i + 1] = dp[i] + a[2 * i] - a[2 * i + 1]
    return dp
def main():
    n = int(input())
    a = list(map(int, input().split()))
    l = f(a)
    r = list(reversed(f(list(reversed(a)))))
    print(max([l[i] + r[i] for i in range(n // 2 + 1)]))
if __name__ == "__main__":
    main()
0