제출 #729183

#제출 시각아이디문제언어결과실행 시간메모리
729183sofija6게임 (IOI14_game)C++14
42 / 100
1087 ms1348 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...