#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
const int maxn=1510;
int n;
vi head(maxn);
vector<vi> con(maxn,vi(maxn,1));
int get(int a) {
return (a==head[a]?a:head[a]=get(head[a]));
}
void initialize(int _n) {
n=_n;
iota(all(head),0);
for (int i=0; i<n; i++) {
con[i][i]=0;
}
}
int hasEdge(int u, int v) {
int uu=get(u),vv=get(v);
con[uu][vv]--;
con[vv][uu]--;
if (con[uu][vv]==0) {
head[uu]=vv;
for (int i=0; i<n; i++) {
con[i][vv]+=con[i][uu];
con[vv][i]+=con[i][uu];
con[i][uu]=0;
con[uu][i]=0;
}
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... |