Under construction

Still being built. Things may change

Segments

Time limit1.1sMemory limit16 MB

Summary
Given N integer points, pick K distinct segments with the minimum total length and report the points that every optimal choice must use.
Level

Medium7 of 10

Topics
Geometry, Heap, Sorting, Implementation
Solved
No attempts yet

Problem

Vlad really enjoys drawing points on a piece of paper. He has been doing it all day long, but now he decides that he wants to join some of these points using straight lines. There are NN such points, numbered from 00 to N−1N-1, and all of them have integer coordinates. Vlad wants to draw exactly KK distinct line segments. For each segment, he chooses both endpoints from the points he has already drawn. He also wants to minimize the total length of the segments, which is the sum of the lengths of the KK segments.

You will help Vlad find the minimum total length and all the mandatory points. A point is mandatory if it is an endpoint of at least one of the KK segments in every choice of segments that reaches the minimum total length. In other words, if you erase a mandatory point, you cannot reach the same minimum length.

Input

The first line has two positive integers NN and KK. The following NN lines contain the coordinates of each point. All coordinates are integers. The points are numbered from 00 to N−1N-1.

Output

On the first line, print the minimum total length with an error of at most 10−410^{-4} (the first 4 decimals must be correct). The following lines contain the indices of the mandatory points in ascending order.

Constraints

  • 2≤N≤50002 \le N \le 5000
  • 1≤K≤N(N+1)/21 \le K \le N(N+1)/2
  • 1≤K≤1001 \le K \le 100
  • All coordinates are integers in the range [−109,109][-10^9, 10^9].
  • The coordinates of the points are not necessarily distinct.
  • A point may be used as an endpoint for any number of line segments.

Examples1

  1. Example 1

    Input
    6 3
    1 2
    4 5
    2 3
    1 1
    8 8
    7 4
    
    Expected output
    4.65028
    0
    2
    3