Submission #128326

#TimeUsernameProblemLanguageResultExecution timeMemory
128326zeyad49Game (IOI14_game)C++17
42 / 100
1051 ms2692 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...