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 <iostream>
#include <bits/stdc++.h>
#include <game.h>
using namespace std;
#define a first
#define b second
#define pb push_back
#include "game.h"
typedef long long int llo;
int vis[1501];
int n;
int x=1;
int aa[1501][1501];
int par[1501];
int find(int no){
if(par[no]==no){
return no;
}
par[no]=find(par[no]);
return par[no];
}
void initialize(int nn){
n=nn;
for(int i=0;i<n;i++){
par[i]=i;
for(int j=0;j<n;j++){
if(j==i)continue;
aa[i][j]=1;
}
}
}
int hasEdge(int u, int v){
int ac=find(u);
int cc=find(v);
if(ac==cc){
return 0;
}
if(aa[ac][cc]==1){
par[cc]=ac;
for(int i=0;i<n;i++){
if(i==ac){
continue;
}
aa[ac][i]+=aa[cc][i];
aa[i][ac]+=aa[i][cc];
}
return 1;
}
aa[ac][cc]-=1;
aa[cc][ac]-=1;
return 0;
}
/*int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
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... |