結果

問題 No.999 てん vs. ほむ
ユーザー titiatitia
提出日時 2020-02-28 21:33:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 281 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 33,848 KB
最終ジャッジ日時 2024-04-21 18:00:59
合計ジャッジ時間 4,937 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 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,624 KB
testcase_05 AC 32 ms
10,624 KB
testcase_06 AC 31 ms
10,752 KB
testcase_07 AC 32 ms
10,624 KB
testcase_08 AC 39 ms
11,392 KB
testcase_09 AC 257 ms
31,680 KB
testcase_10 AC 98 ms
16,664 KB
testcase_11 AC 77 ms
14,828 KB
testcase_12 AC 129 ms
19,544 KB
testcase_13 AC 277 ms
33,836 KB
testcase_14 AC 279 ms
33,848 KB
testcase_15 AC 281 ms
33,844 KB
testcase_16 AC 281 ms
33,716 KB
testcase_17 AC 246 ms
29,004 KB
testcase_18 AC 247 ms
28,800 KB
testcase_19 AC 244 ms
29,072 KB
testcase_20 AC 250 ms
29,200 KB
testcase_21 AC 249 ms
32,512 KB
testcase_22 AC 246 ms
31,500 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))

LS=[0]
RS=[0]

for i in range(N):
    LS.append(LS[-1]+A[i*2]-A[i*2+1])

for i in range(N):
    RS.append(RS[-1]+A[-i*2-1]-A[-i*2-2])


ANS=-1<<63
for i in range(N+1):
    #print(LS[i]+RS[N-i])
    ANS=max(ANS,LS[i]+RS[N-i])

print(ANS)
0