結果

問題 No.999 てん vs. ほむ
ユーザー AzumabashiAzumabashi
提出日時 2020-04-23 14:13:19
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 33,312 KB
最終ジャッジ日時 2024-04-21 14:26:20
合計ジャッジ時間 3,996 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 30 ms
10,624 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,880 KB
testcase_05 AC 30 ms
10,624 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 29 ms
10,624 KB
testcase_08 AC 35 ms
11,520 KB
testcase_09 AC 170 ms
31,224 KB
testcase_10 AC 71 ms
16,540 KB
testcase_11 AC 57 ms
14,628 KB
testcase_12 AC 91 ms
19,556 KB
testcase_13 AC 186 ms
33,260 KB
testcase_14 AC 184 ms
33,260 KB
testcase_15 AC 185 ms
33,312 KB
testcase_16 AC 185 ms
33,260 KB
testcase_17 WA -
testcase_18 AC 159 ms
28,692 KB
testcase_19 WA -
testcase_20 AC 161 ms
28,748 KB
testcase_21 AC 160 ms
32,496 KB
testcase_22 AC 157 ms
31,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    length = int(input())
    numbers = [int(x) for x in input().split()]
    diff = [0 for _ in range(length)]
    for i in range(length):
        diff[i] = numbers[2 * i + 1] - numbers[2 * i]
        if i > 0:
            diff[i] += diff[i - 1]
    answer = 0
    for i in range(length):
        answer = max(answer, diff[-1] - 2 * diff[i])
    print(answer)


if __name__ == '__main__':
    main()

0