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 <vector>
#include "game.h"
using namespace std;
int const N=1500;
int ed[N][N]={};
bool vis[N]={};
int n;
void dfs(int i)
{
vis[i]=1;
for (int j=0;j<n;j++)
{
if (!vis[j]&&ed[i][j])
dfs(j);
}
}
void initialize(int nn)
{
n=nn;
for (int i=0;i<n;i++)
{
for (int j=0;j<n;j++)
ed[i][j]=1;
}
}
int hasEdge(int u, int v)
{
ed[u][v]=ed[v][u]=0;
for (int i=0;i<n;i++)
vis[i]=0;
dfs(0);
for (int i=0;i<n;i++)
{
if (!vis[i])
{
ed[u][v]=ed[v][u]=1;
return 1;
}
}
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... |