小工具知识网

当前位置: 首页 > 行业知识 > [蓝桥杯 2017 国 C] 合根植物(P8654)

行业知识

[蓝桥杯 2017 国 C] 合根植物(P8654)

2026-11-26 18:30:43 来源:互联网转载
#include #define endl '\n'using ll = long long;typedef unsigned long long ull;using namespace std;void GordenGhost();int n,m;mapfa;int findB(int x){    if (fa[x]==x)return x;    return fa[x]=findB(fa[x]);}void unionSet(int x,int y){    fa[findB(x)]= findB(y);}signed main() {#ifdef Gorden    freopen("in.txt", "rt", stdin);    freopen("out.txt", "wt", stdout);#endif    ios::sync_with_stdio(false);    cin.tie(nullptr), cout.tie(nullptr);    GordenGhost();    return 0;}void GordenGhost() {    cin>>n>>m;    for (int i = 1; i >t;    while(t--){        int a,b;        cin>>a>>b;        unionSet(a,b);    }    int sum=0;    mapmp;    for (int i = 1; i 

上一篇:轻松下载Toobox教程,一步步教你搞定!

下一篇:揭秘DNF喊话技巧,一键呼唤,轻松掌握!