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 <bits/stdc++.h>
#include "game.h"
using namespace std;
int N;
int Par[1500];
int Cnt[1500][1500];
int get_par(int v){
if (v==Par[v])
return v;
return Par[v]=get_par(Par[v]);
}
void initialize(int n){
N=n;
for (int i=0; i<N; i++){
Par[i]=i;
for (int j=0; j<N; j++)
Cnt[i][j]=1;
}
}
int hasEdge(int u,int v){
u=get_par(u);
v=get_par(v);
if (u==v)
return 1;
if (Cnt[u][v]==1){
for (int i=0; i<N; i++){
Cnt[u][i]+=Cnt[v][i];
Cnt[i][u]+=Cnt[i][v];
Cnt[v][i]=Cnt[i][v]=0;
}
Par[v]=u;
return 1;
}
Cnt[u][v]--;
Cnt[v][u]--;
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... |