func_code_string: #include <bits/stdc++.h>   using namespace std;   inline int read() {     int x = 0, f = 1;     char ch = getchar();     for (; !isdigit(ch); ch = getchar())       if (ch ==  - ) f = -1;     for (; isdigit(ch); ch = getchar()) x = x * 10 + ch -  0 ;     return x * f;   }   const int N = 500005, INF = 1e9;   const double DINF = 1e18;   struct Edge {     int fr, to, nxt, cap;     double cost;   } e[N << 1];   int head[N], pre[N], q[N], En = 1, S, T, n;   double dis[N];   bool vis[N];   inline void add_edge(int u, int v, int f, double w) {     ++En;     e[En].fr = u, e[En].to = v, e[En].nxt = head[u], e[En].cap = f,     e[En].cost = w;     head[u] = En;     ++En;     e[En].fr = v, e[En].to = u, e[En].nxt = head[v], e[En].cap = 0,     e[En].cost = -w;     head[v] = En;   }   bool spfa() {     for (int i = 0; i <= T; ++i) dis[i] = DINF, vis[i] = false, pre[i] = 0;     int L = 1, R = 0;     dis[S] = 0, q[++R] = S, vis[S] = true, pre[S] = 0;     while (L <= R) {       int u = q[L++];       vis[u] = false;       for (int i = head[u]; i; i = e[i].nxt) {         int v = e[i].to;         if (dis[v] > dis[u] + e[i].cost && e[i].cap > 0) {           dis[v] = dis[u] + e[i].cost;           pre[v] = i;           if (!vis[v]) q[++R] = v;         }       }     }     return dis[T] != DINF;   }   void mcf() {     int Flow = 0;     double Cost = 0;     while (spfa()) {       int now = INF;       for (int i = T; i != S; i = e[pre[i]].fr) now = min(now, e[pre[i]].cap);       for (int i = T; i != S; i = e[pre[i]].fr)         e[pre[i]].cap -= now, e[pre[i] ^ 1].cap += now;       Flow += now;       Cost += 1.0 * now * dis[T];     }     if (Flow >= n - 1)       printf( %.10lf , Cost);     else       puts( -1 );   }   struct Node {     int x, y;   } A[N];   int sqr(int x) { return x * x; }   double dist(const Node &A, const Node &B) {     return sqrt(1.0 * (sqr(A.x - B.x) + sqr(A.y - B.y)));   }   int main() {     n = read();     for (int i = 1; i <= n; ++i) A[i].x = read(), A[i].y = read();     S = 0, T = n + n + 1;     for (int i = 1; i <= n; ++i) add_edge(S, i, 2, 0), add_edge(i + n, T, 1, 0);     for (int i = 1; i <= n; ++i)       for (int j = 1; j <= n; ++j)         if (A[j].y > A[i].y) add_edge(j, i + n, 1, dist(A[i], A[j]));     mcf();     return 0;   }   