#include #define rep(i,n) for(int i=0;i void chmin(T& a, T b){a = min(a, b);} const long double INF = 8000000000000000; int main(){ int N, K; cin >> N >> K; vector x(N + 1), y(N + 1); rep(i, N) cin >> x[i] >> y[i]; x[N] = 0; y[N] = 0; vector> dist(N + 1, vector(N + 1)); rep(i, N + 1) rep(j, N + 1){ long double res = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]); dist[i][j] = sqrtl(res); } vector>> dp(1 << N, vector>(N + 1, vector(K + 1, INF))); dp[0][N][K] = 0; rep(bit, 1 << N){ rep(from, N + 1){ if(from < N) if((~bit >> from) & 1) continue; for(int k = 1; k <= K; k++){ rep(to, N){ if((bit >> to) & 1) continue; chmin(dp[bit | (1 << to)][to][k - 1], dp[bit][from][k] + dist[from][to]); } } for(int k = 0; k <= K; k++) chmin(dp[bit][N][K], dp[bit][from][k] + dist[from][N]); } } cout << setprecision(15); cout << dp[(1 << N) - 1][N][K] << "\n"; return 0; }