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 maxn 1505
int n;
int a[maxn];
int edge[maxn][maxn];
void dfs(int x) {
a[x] = 1;
for(int i=0;i<n;i++) if(!a[i] && edge[x][i]) dfs(i);
}
bool check(int x,int y) {
memset(a,0,sizeof(a));
dfs(x);
if(a[y]) return 1;
return 0;
}
void initialize(int N) {
n = N;
memset(edge,1,sizeof(edge));
}
int hasEdge(int u, int v) {
edge[u][v] = edge[v][u] = 0;
if(!check(u,v)) edge[u][v] = edge[v][u] = 1;
return edge[u][v];
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |