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 "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
const int N=1500;
int c[N][N];
int pa[N];
int Find(int k){
if(pa[k]==k){
return k;
}
return pa[k]=Find(pa[k]);
}
void onion(int a,int b){
pa[b]=a;
for(int i=0;i<N;i++){
if(i==Find(i)){
c[a][i]+=c[b][i];
c[i][a]=c[a][i];
}
}
}
void initialize(int n) {
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i!=j)c[i][j]=1;
}
pa[i]=i;
}
}
int hasEdge(int u, int v) {
if(u>v)swap(u,v);
u=Find(u);
v=Find(v);
c[u][v]--;
c[v][u]--;
if(!c[u][v]){
onion(u,v);
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... |