結果

問題 No.999 てん vs. ほむ
ユーザー uni_pythonuni_python
提出日時 2020-07-21 23:21:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 673 bytes
コンパイル時間 887 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 114,080 KB
最終ジャッジ日時 2023-08-30 05:03:35
合計ジャッジ時間 4,978 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 72 ms
71,048 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 142 ms
113,264 KB
testcase_22 AC 141 ms
113,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input=sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    N=I()
    A=LI()
    L=[]
    for i in range(0,2*N,2):
        a=A[i]
        b=A[i]
        L.append(a-b)
    L2=[]
    for i in range(N):
        L2.append(-1*L[i])
        
    S=[0]*(N+1)
    for i in range(N):
        S[i+1]=S[i]+L[i]
        
    S2=[0]*(N+1)
    for i in range(N-1,0,-1):
        S[i]=S[i+1]+L2[i]
        
    ans=-10**20
    for i in range(N):
        temp=S[i]+S2[i]
        if temp>ans:
            ans=temp

            
    print(ans)
    
    


main()
0