結果

問題 No.999 てん vs. ほむ
ユーザー stng
提出日時 2022-08-17 16:37:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 326 bytes
コンパイル時間 621 ms
コンパイル使用メモリ 82,072 KB
実行使用メモリ 97,212 KB
最終ジャッジ日時 2024-10-04 19:01:27
合計ジャッジ時間 3,950 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = [int(i) for i in input().split()]

rt = [0]*n
for i in range(n):
    rt[i] = a[2*n-1-(i*2)]-a[2*n-1-(i*2+1)]

rui = [0]*(n+1)
for i in range(n):
    rui[i+1] = rui[i]+rt[i]
#print(rui)
#exit()
ans = -10**10
tmp = 0
for i in range(n):
    tmp += a[i*2]-a[i*2+1]
    ans = max(ans,tmp+rui[n-i-1])
print(ans)
0