제출 #72603

#제출 시각아이디문제언어결과실행 시간메모리
72603vexGame (IOI14_game)C++14
0 / 100
3 ms468 KiB
#include <bits/stdc++.h>
#define maxn 1505
using namespace std;

int n;
int sz[maxn],p[maxn];
int uk=0;
void initialize(int N)
{
    n=N;
    for(int i=0;i<n;i++)
    {
        sz[i]=1;
        p[i]=i;
    }
}
int fnd(int x)
{
    if(x==p[x])return x;
    return p[x]=fnd(p[x]);
}
int hasEdge(int u,int v)
{
    u=fnd(u);
    v=fnd(v);
    
    if(u==v)return 1;
    if(sz[u]+sz[v]<n)
    {
        if(sz[u]<sz[v])swap(u,v);
        sz[u]+=sz[v];
        p[v]=u;
        return 1;
    }
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...