結果

問題 No.999 てん vs. ほむ
ユーザー NoneNone
提出日時 2021-05-05 02:42:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 273 bytes
コンパイル時間 378 ms
コンパイル使用メモリ 87,016 KB
実行使用メモリ 100,020 KB
最終ジャッジ日時 2023-10-01 04:40:05
合計ジャッジ時間 5,469 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,536 KB
testcase_01 AC 90 ms
71,524 KB
testcase_02 AC 90 ms
71,348 KB
testcase_03 AC 90 ms
71,528 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 88 ms
71,404 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 180 ms
94,300 KB
testcase_18 AC 175 ms
94,228 KB
testcase_19 AC 175 ms
94,420 KB
testcase_20 AC 179 ms
94,420 KB
testcase_21 AC 184 ms
99,868 KB
testcase_22 AC 184 ms
99,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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