結果

問題 No.999 てん vs. ほむ
ユーザー brthyyjpbrthyyjp
提出日時 2020-03-28 18:52:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 143 ms / 2,000 ms
コード長 369 bytes
コンパイル時間 1,868 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 114,268 KB
最終ジャッジ日時 2023-08-30 18:06:14
合計ジャッジ時間 4,447 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,368 KB
testcase_01 AC 69 ms
71,340 KB
testcase_02 AC 69 ms
71,232 KB
testcase_03 AC 69 ms
71,368 KB
testcase_04 AC 70 ms
71,468 KB
testcase_05 AC 69 ms
71,368 KB
testcase_06 AC 67 ms
71,280 KB
testcase_07 AC 68 ms
71,132 KB
testcase_08 AC 89 ms
76,604 KB
testcase_09 AC 134 ms
109,768 KB
testcase_10 AC 90 ms
85,748 KB
testcase_11 AC 87 ms
81,824 KB
testcase_12 AC 99 ms
92,716 KB
testcase_13 AC 143 ms
114,100 KB
testcase_14 AC 140 ms
114,268 KB
testcase_15 AC 141 ms
114,060 KB
testcase_16 AC 140 ms
113,876 KB
testcase_17 AC 122 ms
105,228 KB
testcase_18 AC 122 ms
105,196 KB
testcase_19 AC 121 ms
105,296 KB
testcase_20 AC 123 ms
105,184 KB
testcase_21 AC 139 ms
113,740 KB
testcase_22 AC 137 ms
113,624 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

cL = [0]*(n+1)
cR = [0]*(n+1)

L = []
R = []
for i in range(2*n):
    if i%2 == 0:
        L.append(A[i])
    else:
        R.append(A[i])

R.reverse()
for i in range(n):
    cL[i+1] = cL[i]+L[i]
    cR[i+1] = cR[i]+R[i]

ans = 0
for i in range(n+1):
    j = n-i
    ans = max(ans, cL[i]+cR[j])
print(2*ans-sum(A))
0