This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "game.h"
#include <bits/stdc++.h>
using namespace std;
int N,p[1501],cnt[1501][1501];
int f(int u){
return (p[u]==u?u:p[u]=f(p[u]));
}
void initialize(int n){
N=n;
iota(p,p+n,0);
for (int i=0;i<n;i++)
for (int j=0;j<n;j++)
cnt[i][j]=1;
}
int hasEdge(int u, int v){
u=f(u);
v=f(v);
cnt[u][v]--;
cnt[v][u]--;
if (!cnt[u][v]){
p[v]=u;
for (int i=0;i<N;i++)
if (i==f(i)&&i!=u){
cnt[u][i]+=cnt[v][i];
cnt[i][u]+=cnt[v][i];
}
}
return (!cnt[u][v]);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |