結果

問題 No.999 てん vs. ほむ
ユーザー Kiri8128Kiri8128
提出日時 2020-02-28 22:16:03
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 275 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 37,104 KB
最終ジャッジ日時 2024-04-21 19:06:34
合計ジャッジ時間 3,909 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,624 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 36 ms
11,520 KB
testcase_09 AC 198 ms
33,924 KB
testcase_10 AC 80 ms
17,812 KB
testcase_11 AC 63 ms
15,392 KB
testcase_12 AC 106 ms
21,528 KB
testcase_13 AC 214 ms
36,336 KB
testcase_14 AC 216 ms
36,460 KB
testcase_15 AC 216 ms
37,104 KB
testcase_16 AC 219 ms
36,680 KB
testcase_17 AC 190 ms
32,732 KB
testcase_18 AC 189 ms
32,184 KB
testcase_19 AC 194 ms
32,408 KB
testcase_20 AC 191 ms
32,512 KB
testcase_21 AC 179 ms
32,536 KB
testcase_22 AC 180 ms
31,520 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