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>
using namespace std;
const int N=100;
int n;
bool visited[N];
bool adj[N][N],queried[N][N];
void initialize(int x) {
n=x;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
queried[i][j]=false;
adj[i][j]=false;
}
}
}
void dfs(int u) {
visited[u]=true;
for(int v=0;v<n;v++)
if(adj[u][v] && !visited[v])
dfs(v);
}
int hasEdge(int u,int v) {
queried[u][v]=queried[v][u]=true;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++)
adj[i][j]=!queried[i][j];
visited[i]=false;
}
dfs(u);
if(visited[v])
return 0;
queried[u][v]=queried[v][u]=false;
return 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... |