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;
const int Nmax = 1505;
bool edge[Nmax][Nmax], used[Nmax];
int n;
void initialize(int N)
{
n = N;
int i, j;
for(i=0; i<n; ++i)
for(j=0; j<n; ++j)
edge[i][j] = (i != j);
}
void dfs(int node)
{
used[node] = 1;
for(int i = 0; i<n; ++i)
if(!used[i] && edge[node][i]) dfs(i);
}
int hasEdge(int u, int v)
{
int i;
for(i=0; i<n; ++i) used[i] = 0;
edge[u][v] = edge[v][u] = 0;
dfs(0);
bool ok = 1;
for(i=0; i<n; ++i)
ok &= used[i];
if(!ok)
edge[u][v] = edge[v][u] = 1;
return (ok ^ 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... |