이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "game.h"
#include <vector>
using namespace std;
int con=0,a,b,ok=0;
int Father[1505];
int sz[1505];
vector < pair < int , int > > all;
int Find(int here)
{
if(Father[here]==here) return here;
Father[here]=Find(Father[here]);
return Father[here];
}
void initialize(int n)
{
int i;
for(i=0;i<n;i++)
{
Father[i]=i;
sz[i]=1;
}
return ;
}
int hasEdge(int u, int v)
{
int con=0;
if(Find(u)==Find(v)) return 0;
all.push_back(make_pair(u,v));
for(auto i:all)
{
if(Find(i.first)==Find(u)&&Find(i.second)==Find(v)) con++;
if(Find(i.first)==Find(v)&&Find(i.second)==Find(u)) con++;
}
if(con==sz[Find(u)]*sz[Find(v)])
{
sz[Find(u)]+=sz[Find(v)];
Father[Find(v)]=Find(u);
return 1;
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |