結果

問題 No.999 てん vs. ほむ
ユーザー KodaiKodai
提出日時 2020-04-16 22:30:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 34,464 KB
最終ジャッジ日時 2024-04-10 11:27:39
合計ジャッジ時間 4,320 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
11,008 KB
testcase_01 AC 34 ms
11,008 KB
testcase_02 AC 34 ms
11,264 KB
testcase_03 AC 33 ms
11,264 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 34 ms
11,264 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 157 ms
30,812 KB
testcase_18 AC 157 ms
29,220 KB
testcase_19 AC 161 ms
29,624 KB
testcase_20 AC 158 ms
30,404 KB
testcase_21 AC 160 ms
34,464 KB
testcase_22 AC 160 ms
31,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import queue

N = int(input())
que = queue.deque(list(map(int, input().split())))
point = 0
while True:
    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