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>
using namespace std;
#define N 1505
int ata[N],rem[N],n;
int bul(int node) {
if(ata[node]==node) return node;
return ata[node]=bul(ata[node]);
}
void initialize(int n) {
::n=n;
for(int i=0;i<n;i++) {
rem[i]=n-1;
ata[i]=i;
}
}
int hasEdge(int u, int v) {
int au=bul(u);
int av=bul(v);
rem[av]--;
rem[au]--;
if(rem[au]==0 || rem[av]==0) {
rem[av]+=rem[au];
ata[au]=av;
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... |