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>
using namespace std;
#ifndef wambule
#include "game.h"
#endif
const int N = 1503;
int opw[N], r[N][N], globn;
int P(int x) {
return (opw[x] ? opw[x] = P(opw[x]) : x);
}
void initialize(int n) {
// hello wambule
globn = n;
for(int i = 0; i < n; ++i) {
opw[i] = 0;
for(int j = 0; j < n; ++j)
r[i][j] = (i != j);
}
}
int hasEdge(int x, int y) {
int n = globn;
x = P(x);
y = P(y);
assert(x ^ y);
--r[x][y];
--r[y][x];
if(r[x][y])
return 0;
for(int i = 0; i < n; ++i) {
r[x][i] += r[y][i];
r[i][x] += r[i][y];
}
opw[y] = x;
return 1;
}
#ifdef wambule
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
return 0;
}
#endif
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |