結果

問題 No.999 てん vs. ほむ
ユーザー masa_aamasa_aa
提出日時 2020-02-28 21:31:44
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 205 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 32,636 KB
最終ジャッジ日時 2024-10-13 16:50:42
合計ジャッジ時間 3,261 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
l,r=0,2*n-1
ans=0
while l<r:
    if a[l]-a[l+1]>a[r]-a[r-1]:
        ans+=a[l]-a[l+1]
        l+=2
    else:
        ans+=a[r]-a[r-1]
        r-=2
print(ans)
0