結果

問題 No.999 てん vs. ほむ
ユーザー konchanksukonchanksu
提出日時 2020-03-07 20:08:44
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 204 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 32,640 KB
最終ジャッジ日時 2024-04-23 14:18:50
合計ジャッジ時間 3,150 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,624 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 30 ms
10,496 KB
testcase_03 AC 33 ms
10,624 KB
testcase_04 AC 33 ms
10,624 KB
testcase_05 AC 32 ms
10,752 KB
testcase_06 AC 29 ms
10,496 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 35 ms
11,392 KB
testcase_09 AC 125 ms
30,812 KB
testcase_10 AC 57 ms
16,780 KB
testcase_11 AC 48 ms
14,748 KB
testcase_12 AC 70 ms
19,536 KB
testcase_13 AC 136 ms
32,636 KB
testcase_14 AC 136 ms
32,448 KB
testcase_15 AC 140 ms
32,640 KB
testcase_16 AC 142 ms
32,632 KB
testcase_17 AC 126 ms
29,124 KB
testcase_18 AC 123 ms
28,684 KB
testcase_19 AC 120 ms
28,968 KB
testcase_20 AC 132 ms
29,260 KB
testcase_21 AC 135 ms
32,476 KB
testcase_22 AC 130 ms
31,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
big = sum(a[1::2])
tmp = big
for i in range(0, 2 * n, 2):
    tmp = tmp + a[i] - a[i + 1]
    if tmp > big:
        big = tmp

print(2 * big - sum(a))
0