제출 #581375

#제출 시각아이디문제언어결과실행 시간메모리
581375wdjpng게임 (IOI14_game)C++17
42 / 100
1069 ms4524 KiB
#include "game.h" #include <bits/stdc++.h> #define int long long #define rep(i,n) for(int i = 0; i < n; i++) #define all(a) a.begin(), a.end() using namespace std; int n; vector<vector<bool>>forb; void initialize(signed N) { n=N; forb.assign(n,vector<bool>(n,false)); } vector<bool>vis; void dfs(int v, vector<vector<int>>&E) { vis[v]=true; for(int w : E[v]) if(!vis[w]) dfs(w, E); } bool con() { vector<vector<int>>E(n); rep(i,n) rep(j,n) if(i!=j&&!forb[i][j]) E[i].push_back(j); vis.assign(n,false); dfs(0,E); return count(all(vis),true)==n; } signed hasEdge(signed u, signed v) { forb[u][v]=forb[v][u]=true; if(con()) return 0; else { forb[u][v]=forb[v][u]=false; return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...