結果

問題 No.999 てん vs. ほむ
ユーザー None
提出日時 2021-05-05 02:42:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 273 bytes
コンパイル時間 426 ms
コンパイル使用メモリ 82,464 KB
実行使用メモリ 100,016 KB
最終ジャッジ日時 2024-07-23 22:02:58
合計ジャッジ時間 3,728 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
N=int(input())
A=deque(map(int, input().split()))
res=0
for i in range(N):
    a=A[0]-A[1]
    b=A[-1]-A[-2]
    if a>b:
        A.popleft()
        A.popleft()
        res+=a
    else:
        A.pop()
        A.pop()
        res+=b
print(res)
0