結果

問題 No.999 てん vs. ほむ
ユーザー convexineqconvexineq
提出日時 2021-02-13 20:39:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 401 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 111,500 KB
最終ジャッジ日時 2023-09-28 06:04:39
合計ジャッジ時間 5,399 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,308 KB
testcase_01 AC 67 ms
71,364 KB
testcase_02 AC 68 ms
71,172 KB
testcase_03 AC 68 ms
71,296 KB
testcase_04 AC 68 ms
71,160 KB
testcase_05 AC 68 ms
71,304 KB
testcase_06 AC 67 ms
71,312 KB
testcase_07 AC 66 ms
71,368 KB
testcase_08 AC 76 ms
76,388 KB
testcase_09 AC 127 ms
102,408 KB
testcase_10 AC 86 ms
85,072 KB
testcase_11 AC 83 ms
81,476 KB
testcase_12 AC 94 ms
89,836 KB
testcase_13 AC 132 ms
105,644 KB
testcase_14 AC 131 ms
105,632 KB
testcase_15 AC 133 ms
105,664 KB
testcase_16 AC 129 ms
105,396 KB
testcase_17 AC 123 ms
111,500 KB
testcase_18 AC 115 ms
107,624 KB
testcase_19 AC 123 ms
111,332 KB
testcase_20 AC 123 ms
111,312 KB
testcase_21 AC 130 ms
105,276 KB
testcase_22 AC 131 ms
104,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
*a, = map(int,input().split())
res = [0]*(n+1)
for i in range(n):
    res[i] = a[2*i]-a[2*i+1]
t = sum(res)
for i in range(n)[::-1]:
    res[i] += res[i+1]
ans = -1<<31
for i in range(n+1):
    ans = max(ans,t-2*res[i])
print(ans)
0