I题 一道板子题 给大家送25分的

(王巨太善良了 这题其实是我准备的F 被拦下来)

30% 送分怎么拿 都行

100% 最小生成树板子 我标程是Kruskal的 没什么可讲的 看代码

 #include<iostream>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<iomanip>
#include<math.h>
using namespace std;
#pragma GCC optimize(3)
static char buf[100000], * a = buf, * d = buf;
#define gc a==d&&(d=(a=buf)+fread(buf,1,100000,stdin),a==d)?EOF:*a++
inline int read() {
     int x(0);  char c(gc);
    while (c > '9' || c < '0')c = gc;
    while (c <= '9' && c >= '0')x = (x << 1) + (x << 3) + (c ^ 48), c = gc;
    return x;
}
int n, m;
struct mz
{
    int x, y, t;
}tz[1100000];
int cmp(struct mz& q, struct mz& p)
{
    return q.t < p.t;
}
int bcj[1100000];
int bcq[1100000];
int find(int zz)
{
    return bcj[zz] == zz ? bcj[zz] : bcj[zz] = find(bcj[zz]);
}
int main()
{
    //freopen("1.in", " r ", stdin);
    //freopen("1.out", " w ", stdout);
    n = read(); m = read();
    for (int i = 1; i <= m; i++)
    {
        tz[i].x = read(); tz[i].y = read(); tz[i].t = read();
    }
    sort(tz + 1, tz + m + 1, cmp);
    for (int i = 1; i <= n; i++)
    {
        bcj[i] = i;
        bcq[i] = 1;
    }
    for (int i = 1; i <= m; i++)
    {
        int fpy = find(tz[i].y), fpx = find(tz[i].x);
        if (fpy != fpx)
        {
            bcj[fpy] = fpx;
            bcq[fpx] += bcq[fpy];

        }
        if (bcq[fpx] == n)
        {
            cout << tz[i].t; return 0;
        }
    }
    cout << -1;
    return 0;
}