結果

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

ソースコード

diff #

from collections import deque

l, r = 0, 0
h, t = 0, 0
n = int(input())
A = deque(map(int, input().split()))
while A:
    l = A[0]-A[1]
    r = A[-1]-A[-2]
    if l >= r:
        h += A.popleft()
        t += A.popleft()
    else:
        h += A.pop()
        t += A.pop()
print(h-t)
0