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>
#define MAXN 1510
using namespace std;
bool G[MAXN][MAXN],a[MAXN];
int N;
void initialize(int n)
{
N=n;
for (int i=0;i<n;i++)
{
for (int j=0;j<n;j++)
G[i][j]=true;
}
}
void DFS(int i,pair<int,int> skipp)
{
a[i]=true;
for (int next=0;next<N;next++)
{
if ((i==skipp.first && next==skipp.second) || (i==skipp.second && next==skipp.first))
continue;
if (!a[next] && G[i][next])
DFS(next,skipp);
}
}
bool Check(int u,int v)
{
for (int i=0;i<N;i++)
a[i]=false;
DFS(u,{u,v});
for (int i=0;i<N;i++)
{
if (!a[i])
return true;
}
return false;
}
int hasEdge(int u, int v)
{
if (Check(u,v))
return 1;
G[u][v]=0;
G[v][u]=0;
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... |