跳到正文

_wangningxin2014_

1382877

在洛谷打开
资料、奖项与版本

资料

编号
1382877
抓取

陶片放逐

无权限变更

查看记录

号主换号了,你们要就你们要去吧。(因比赛用AI棕了,原本是绿名,只棕了一次)

密码:wlgc2018


C++
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define pll pair<ll,ll>
#define el '\n'
const ll N=2e5+5;

void solve(){
    
}
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	//freopen("xxx.in","r",stdin);
	//freopen("xxx.out","w",stdout);
	ll T=1;//cin>>T;
	while(T--){
		solve();
	}
	return 0;
}

//以下是并查集的函数

void init(ll n)
{
    for (ll i = 1; i <= n; i++)
        pre[i] = i + n, pre[n + i] = n + i;
}
ll find(ll x)
{
    if (pre[x] == x)
        return x;
    return pre[x] = find(pre[x]);
}
void merge(ll x, ll y)
{
    ll fx = find(x), fy = find(y);
    if (fx != fy)
        pre[fx] = fy;
}
void erase(ll x)
{
    pre[x] = 2 * n + ++cnt;
    pre[2 * n + cnt] = 2 * n + cnt;
}

还没有收录这位用户的文章。