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;
#include "game.h"
#define N 1502
int T[N][N],ata[N],sz[N],n;
int find(int x){
return ata[x] == x ? x : ata[x] = find(ata[x]);
}
int hasEdge(int x, int y){
if((x=find(x)) == (y=find(y))) assert(0);
if(T[x][y] < sz[x]*sz[y]-1){
T[x][y]++;
T[y][x]++;
return 0;
}
ata[y] = x;
sz[x] += sz[y];
for(int i=0;i<n;i++){
T[x][i] += T[y][i];
T[i][x] += T[y][i];
}
return 1;
}
void initialize(int ss){
n = ss;
for(int i=0; i<n; i++){
ata[i] = i;
sz[i] = 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... |