結果

問題 No.999 てん vs. ほむ
ユーザー Kodai
提出日時 2020-04-16 22:35:14
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 346 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 34,472 KB
最終ジャッジ日時 2024-10-02 13:35:56
合計ジャッジ時間 4,099 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 8 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import queue

N = int(input())
que = queue.deque(list(map(int, input().split())))
point = 0
for i in range(N):
    if len(que) >= 2:
        left = que[0]-que[1]
        right = que[-1]-que[-2]
        if left > right:
            point += left
            que.popleft()
            que.popleft()
        else:
            point += right
            que.pop()
            que.pop()
    elif len(que) == 1:
        point += que[0]
        break
    else:
        break

print(point)
0