이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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] = 1;
}
}
int hasEdge(int x, int y) {
int n = globn;
x = P(x);
y = P(y);
if(x == y) return 0;
if(r[x][y] ^ 1) {
--r[x][y];
--r[y][x];
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... |