結果

問題 No.999 てん vs. ほむ
ユーザー 12354865271235486527
提出日時 2020-03-20 04:03:57
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 221 ms / 2,000 ms
コード長 263 bytes
コンパイル時間 389 ms
コンパイル使用メモリ 10,524 KB
実行使用メモリ 31,456 KB
最終ジャッジ日時 2023-08-20 21:28:01
合計ジャッジ時間 4,550 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,856 KB
testcase_01 AC 17 ms
7,740 KB
testcase_02 AC 16 ms
7,756 KB
testcase_03 AC 16 ms
7,852 KB
testcase_04 AC 15 ms
7,820 KB
testcase_05 AC 16 ms
7,772 KB
testcase_06 AC 16 ms
7,812 KB
testcase_07 AC 16 ms
7,772 KB
testcase_08 AC 22 ms
8,936 KB
testcase_09 AC 200 ms
28,348 KB
testcase_10 AC 70 ms
14,232 KB
testcase_11 AC 51 ms
12,684 KB
testcase_12 AC 95 ms
17,072 KB
testcase_13 AC 219 ms
29,960 KB
testcase_14 AC 214 ms
29,964 KB
testcase_15 AC 214 ms
29,984 KB
testcase_16 AC 221 ms
29,792 KB
testcase_17 AC 188 ms
30,356 KB
testcase_18 AC 190 ms
29,104 KB
testcase_19 AC 190 ms
29,208 KB
testcase_20 AC 189 ms
29,388 KB
testcase_21 AC 197 ms
31,456 KB
testcase_22 AC 193 ms
29,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
lft = [0]
rgt = [0]
for i in range(N):
    lft.append(lft[-1] + A[i*2] - A[i*2+1])
    rgt.append(rgt[-1] + A[-i*2-1] - A[-i*2-2])
ans = 0
for i in range(N+1):
    ans = max(ans, lft[i] + rgt[-i-1])
print(ans)
0