Submission #729174

#TimeUsernameProblemLanguageResultExecution timeMemory
729174sofija6Game (IOI14_game)C++14
42 / 100
1089 ms1108 KiB
#include <bits/stdc++.h> #define MAXN 1510 using namespace std; bool G[MAXN][MAXN],a[MAXN],b[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,bool *s) { s[i]=true; for (int next=0;next<N;next++) { if ((i==skipp.first && next==skipp.second) || (i==skipp.second && next==skipp.first)) continue; if (!s[next] && G[i][next]) DFS(next,skipp,s); } } bool Check(int u,int v) { for (int i=0;i<N;i++) { a[i]=false; b[i]=false; } DFS(u,{u,v},a); DFS(v,{u,v},b); for (int i=0;i<N;i++) { if (!a[i] || !b[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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...