結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
11,008 KB
testcase_01 AC 37 ms
11,008 KB
testcase_02 AC 34 ms
11,136 KB
testcase_03 AC 34 ms
11,008 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 33 ms
11,008 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 165 ms
29,408 KB
testcase_18 AC 166 ms
29,356 KB
testcase_19 AC 166 ms
29,496 KB
testcase_20 AC 169 ms
29,296 KB
testcase_21 AC 171 ms
34,472 KB
testcase_22 AC 164 ms
31,932 KB
権限があれば一括ダウンロードができます

ソースコード

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