結果
| 問題 |
No.370 道路の掃除
|
| コンテスト | |
| ユーザー |
htkb
|
| 提出日時 | 2018-05-29 21:42:25 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 343 bytes |
| コンパイル時間 | 167 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 10,880 KB |
| 最終ジャッジ日時 | 2024-06-30 08:03:36 |
| 合計ジャッジ時間 | 2,076 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 16 RE * 18 |
ソースコード
from bisect import bisect_left
N, M = map(int, input().split())
a = sorted([int(input()) for _ in [0]*M])
bound = bisect_left(a, 0)
if a[bound] != 0:
a.insert(bound, 0)
N += 1
ans = float("inf")
for i in range(max(0, bound-N+1), bound+1):
left, right = abs(a[i]), a[i+N-1]
ans = min(ans, left*2+right, left+right*2)
print(ans)
htkb