結果

問題 No.999 てん vs. ほむ
ユーザー titiatitia
提出日時 2020-02-28 21:33:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 214 ms / 2,000 ms
コード長 286 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 10,532 KB
実行使用メモリ 30,820 KB
最終ジャッジ日時 2023-08-03 19:43:36
合計ジャッジ時間 4,157 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,788 KB
testcase_01 AC 15 ms
7,788 KB
testcase_02 AC 15 ms
7,808 KB
testcase_03 AC 14 ms
7,980 KB
testcase_04 AC 15 ms
7,784 KB
testcase_05 AC 15 ms
7,840 KB
testcase_06 AC 15 ms
7,840 KB
testcase_07 AC 15 ms
7,856 KB
testcase_08 AC 20 ms
9,048 KB
testcase_09 AC 196 ms
28,124 KB
testcase_10 AC 68 ms
14,132 KB
testcase_11 AC 50 ms
12,468 KB
testcase_12 AC 92 ms
17,148 KB
testcase_13 AC 211 ms
29,904 KB
testcase_14 AC 212 ms
29,908 KB
testcase_15 AC 210 ms
30,028 KB
testcase_16 AC 214 ms
29,996 KB
testcase_17 AC 183 ms
30,820 KB
testcase_18 AC 187 ms
28,996 KB
testcase_19 AC 189 ms
29,272 KB
testcase_20 AC 189 ms
29,436 KB
testcase_21 AC 190 ms
29,772 KB
testcase_22 AC 186 ms
29,824 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