結果

問題 No.999 てん vs. ほむ
コンテスト
ユーザー None
提出日時 2021-05-05 02:42:33
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 273 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 183 ms
コンパイル使用メモリ 85,376 KB
実行使用メモリ 110,720 KB
最終ジャッジ日時 2026-04-03 16:33:41
合計ジャッジ時間 2,337 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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