結果

問題 No.999 てん vs. ほむ
ユーザー ntudantuda
提出日時 2024-01-01 13:54:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 258 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 108,432 KB
最終ジャッジ日時 2024-01-01 13:54:06
合計ジャッジ時間 3,291 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
53,332 KB
testcase_01 AC 35 ms
53,332 KB
testcase_02 AC 35 ms
53,332 KB
testcase_03 AC 36 ms
53,332 KB
testcase_04 AC 34 ms
53,332 KB
testcase_05 AC 33 ms
53,332 KB
testcase_06 AC 34 ms
53,332 KB
testcase_07 AC 34 ms
53,332 KB
testcase_08 AC 41 ms
62,068 KB
testcase_09 AC 97 ms
105,352 KB
testcase_10 AC 51 ms
73,756 KB
testcase_11 AC 47 ms
70,708 KB
testcase_12 AC 56 ms
80,208 KB
testcase_13 AC 94 ms
101,728 KB
testcase_14 AC 95 ms
101,728 KB
testcase_15 AC 94 ms
101,728 KB
testcase_16 AC 94 ms
101,728 KB
testcase_17 AC 76 ms
100,664 KB
testcase_18 AC 75 ms
100,568 KB
testcase_19 AC 76 ms
100,660 KB
testcase_20 AC 77 ms
100,688 KB
testcase_21 AC 92 ms
101,536 KB
testcase_22 AC 90 ms
108,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
B = [0] * (N + 1)
C = [0] * (N + 1)

for i in range(N):
    B[i + 1] = A[i * 2] - A[i * 2 + 1] + B[i]
    C[N - i - 1] = A[(N - i) * 2 - 1] - A[(N - i) * 2 - 2] + C[N - i]
ans = 0

for i in range(N + 1):
    ans = max(ans, B[i] + C[i])
print(ans)
0