結果

問題 No.999 てん vs. ほむ
ユーザー uni_pythonuni_python
提出日時 2020-07-21 23:13:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 457 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 87,364 KB
実行使用メモリ 102,112 KB
最終ジャッジ日時 2023-08-30 04:49:24
合計ジャッジ時間 4,499 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,292 KB
testcase_01 AC 71 ms
71,348 KB
testcase_02 AC 73 ms
70,904 KB
testcase_03 AC 71 ms
71,264 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 73 ms
71,132 KB
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 AC 112 ms
102,112 KB
testcase_18 AC 110 ms
101,644 KB
testcase_19 AC 110 ms
101,608 KB
testcase_20 AC 110 ms
101,764 KB
testcase_21 AC 125 ms
99,164 KB
testcase_22 AC 125 ms
99,144 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=0
    r=2*N-1
    
    ans=0
    for i in range(N):
        a=A[l]-A[l+1]
        b=A[r]-A[r-1]
        if a>b:
            ans+=a
            l+=2
        else:
            ans+=b
            r-=2
            
    print(ans)
    
    


main()
0