#include namespace { #pragma GCC diagnostic ignored "-Wunused-function" #include #pragma GCC diagnostic warning "-Wunused-function" using namespace std; using namespace atcoder; #define rep(i,n) for(int i = 0; i < (int)(n); i++) #define rrep(i,n) for(int i = (int)(n) - 1; i >= 0; i--) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) template bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; } template bool chmin(T& a, const T& b) { if (b < a) { a = b; return true; } else return false; } using ll = long long; using P = pair; using VI = vector; using VVI = vector; using VL = vector; using VVL = vector; double dp[1 << 15][15][15]; double dist[15][15]; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector

xy(n); for (auto& [x, y] : xy) cin >> x >> y; xy.insert(xy.begin(), 1, pair(0, 0)); rep(i, n + 1) rep(j, n + 1) { int dx = xy[i].first - xy[j].first; int dy = xy[i].second - xy[j].second; dist[i][j] = sqrt(ll(dx) * dx + ll(dy) * dy); } constexpr double inf = 1e20; rep(s, 1 << 15) rep(v, 15) rep(kv, 15) dp[s][v][kv] = inf; dp[1][0][k] = 0; rep(s, 1 << (n + 1)) { rep(u, n + 1) rep(ku, k + 1) { chmin(dp[s][0][k], dp[s][u][ku] + dist[u][0]); } rep(u, n + 1) rep(ku, k + 1) if (ku) rep(v, n + 1) { chmin(dp[s | 1 << v][v][ku - 1], dp[s][u][ku] + dist[u][v]); } } cout << fixed << setprecision(12) << dp[(1 << (n + 1)) - 1][0][k] << '\n'; }