Language: C++

#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF 1000000000000000
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}
#define MAX_V 100010
long long cost[MAX_V][MAX_V]; // e=(u,v)のコスト
long long mincost[MAX_V];     //集合Xからの辺の最小コスト
bool used[MAX_V];             //頂点iがXに含まれているか
int V;                        //頂点数

int prim() {
    for(int i = 0; i < V; i++) {
        mincost[i] = INF;
        used[i] = false;
    }
    mincost[0] = 0;
    int res = 0;
    while(true) {
        int v = -1;
        for(int u = 0; u < V; u++) {
            if(!used[u] and (v == -1 || mincost[u] < mincost[v])) {
                v = u;
            }
        }
        if(v == -1) {
            break;
        }
        used[v] = true;
        res += mincost[v];
        for(int u = 0; u < V; u++) {
            mincost[u] = min(mincost[u], cost[v][u]);
        }
    }
    return res;
}
int main() {
    cin >> V;
    int N = V;
    vector<long long> x(N), y(N);
    REP(i, N) { cin >> x[i] >> y[i]; }
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            long long tmp = abs(x[i] - x[j]) + abs(y[i] - y[j]);
            cost[i][j] = tmp;
            cost[j][i] = tmp;
        }
        cost[i][i] = 0;
    }
    cout << prim() << endl;
}

Compiler output:
/tmp/cc134FFr.o: in function `prim()':
a.cc:(.text+0xaf): relocation truncated to fit: R_X86_64_PC32 against symbol `mincost' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0xc9): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0xd7): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0xe3): relocation truncated to fit: R_X86_64_PC32 against symbol `mincost' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0x10a): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0x12f): relocation truncated to fit: R_X86_64_PC32 against symbol `mincost' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0x147): relocation truncated to fit: R_X86_64_PC32 against symbol `mincost' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0x160): relocation truncated to fit: R_X86_64_PC32 against symbol `V' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0x17b): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0x193): relocation truncated to fit: R_X86_64_PC32 against symbol `mincost' defined in .bss section in /tmp/cc134FFr.o
a.cc:(.text+0x1e5): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status