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>
#define N 1500
using namespace std;
int par[N];
int cnt[N][N];
int find(int a){
if(a == par[a])return a;
return par[a] = find(par[a]);
}
int n;
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] = i != j;
}
}
}
int hasEdge(int u, int v){
int tot = max(cnt[find(v)][find(u)],cnt[find(u)][find(v)]);
cnt[find(u)][find(v)]--;
cnt[find(v)][find(u)]--;
if(tot > 1){
return 0;
}
for(int i = 0;i<n;i++){
cnt[find(u)][find(i)] += cnt[find(v)][find(i)];
}
par[find(v)] = find(u);
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |