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 X first
#define Y second
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
using namespace std;
const int MOD = 1e9 + 7;
const ll INF = 1e18;
const int OFF = (1 << 20);
int prt[1505];
int kol[1505][1505];
int maxi;
void initialize(int n) {
maxi = n;
for (int i = 0; i < n; i++) {
prt[i] = i;
for (int j = 0; j < n; j++) {
if (i == j) continue;
kol[i][j] = 1;
}
}
}
int find(int x) {
if (x == prt[x]) return x;
return prt[x] = find(prt[x]);
}
int hasEdge(int x, int y) {
x = find(x);
y = find(y);
if (x == y) return 0;
if (kol[x][y] > 1) {
kol[x][y]--;
kol[y][x]--;
return 0;
}
for (int i = 0; i < maxi; i++) {
kol[x][i] += kol[y][i];
kol[i][x] = kol[x][i];
}
x = prt[y];
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... |