結果
| 問題 |
No.999 てん vs. ほむ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-15 00:41:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 282 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 82,192 KB |
| 実行使用メモリ | 105,088 KB |
| 最終ジャッジ日時 | 2024-09-20 01:07:26 |
| 合計ジャッジ時間 | 3,717 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 WA * 12 |
ソースコード
from collections import deque
N = int(input())
A = list(map(int,input().split()))
if N == 1:
print(max(A)-min(A))
exit()
A = deque(A)
ans = 0
while A:
if A[0]-A[1] > A[-1]-A[-2]:
ans += A.popleft()-A.popleft()
else:
ans += A.pop()-A.pop()
print(ans)