結果
| 問題 | No.999 てん vs. ほむ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-15 00:41:08 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 282 bytes |
| 記録 | |
| コンパイル時間 | 197 ms |
| コンパイル使用メモリ | 85,276 KB |
| 実行使用メモリ | 115,532 KB |
| 最終ジャッジ日時 | 2026-04-08 13:36:33 |
| 合計ジャッジ時間 | 3,170 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)