結果

問題 No.999 てん vs. ほむ
ユーザー Kiri8128Kiri8128
提出日時 2020-02-28 22:16:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 1,030 ms
コンパイル使用メモリ 10,720 KB
実行使用メモリ 34,344 KB
最終ジャッジ日時 2023-08-03 20:40:38
合計ジャッジ時間 3,491 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,736 KB
testcase_01 AC 16 ms
7,732 KB
testcase_02 AC 16 ms
7,772 KB
testcase_03 AC 15 ms
7,768 KB
testcase_04 AC 16 ms
7,732 KB
testcase_05 AC 15 ms
7,812 KB
testcase_06 AC 15 ms
7,752 KB
testcase_07 AC 16 ms
7,792 KB
testcase_08 AC 20 ms
8,676 KB
testcase_09 AC 149 ms
31,608 KB
testcase_10 AC 55 ms
15,156 KB
testcase_11 AC 41 ms
12,580 KB
testcase_12 AC 74 ms
18,768 KB
testcase_13 AC 167 ms
33,624 KB
testcase_14 AC 167 ms
33,460 KB
testcase_15 AC 166 ms
34,344 KB
testcase_16 AC 167 ms
33,944 KB
testcase_17 AC 145 ms
30,836 KB
testcase_18 AC 143 ms
29,776 KB
testcase_19 AC 147 ms
29,564 KB
testcase_20 AC 150 ms
29,900 KB
testcase_21 AC 141 ms
29,796 KB
testcase_22 AC 139 ms
29,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = [int(a) for a in input().split()]
X = [A[i] - A[i+1] for i in range(0, 2 * N, 2)]
L = [0] * (N+1)
for i in range(N):
    L[i+1] = L[i] + X[i]
R = [0] * (N+1)
for i in range(N)[::-1]:
    R[i] = R[i+1] + X[i]

print(max([L[i] - R[i] for i in range(N+1)]))
0