제출 #729170

#제출 시각아이디문제언어결과실행 시간메모리
729170sofija6게임 (IOI14_game)C++14
42 / 100
1080 ms12820 KiB
#include <bits/stdc++.h> #define MAXN 1510 using namespace std; set<int> G[MAXN]; bool 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++) { if (i!=j) G[i].insert(j); } } } void DFS(int i,pair<int,int> skipp,bool *s) { s[i]=true; for (int next : G[i]) { if ((i==skipp.first && next==skipp.second) || (i==skipp.second && next==skipp.first)) continue; if (!s[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].erase(v); G[v].erase(u); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...