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>
#include "game.h"
#define ll long long
#define fi first
#define se second
#define pb push_back
using namespace std;
int n;
const int N=100;
int vis[N],yes[N][N];
void dfs(int x)
{
if(vis[x])return;
vis[x]=1;
for(int it=0;it<n;it++)
{
int z=it,zz=x;
if(z>zz)swap(z,zz);
if(yes[z][zz]!=-1)continue;
if(vis[it])continue;
dfs(it);
}
}
void initialize(int N) {
n=N;
memset(yes,0,sizeof yes);
}
int hasEdge(int x, int y) {
if(x>y)swap(x,y);
dfs(x);memset(vis,0,sizeof vis);
if(vis[y]){
yes[x][y]=0;
yes[y][x]=0;
return 0;
}
yes[x][y]=1;
yes[y][x]=1;
return 1;
}
/*
4
0 1
0 2
0 3
3 1
1 2
3 2
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |