제출 #317798

#제출 시각아이디문제언어결과실행 시간메모리
317798miss_robot게임 (IOI14_game)C++14
42 / 100
1064 ms11904 KiB
#include <bits/stdc++.h> #include "game.h" #pragma GCC optimize("O3") using namespace std; int n; vector< unordered_set<int> > g; vector<int> vis; void initialize(int N){ n = N; g.resize(n); for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) if(i != j) g[i].insert(j); } int hasEdge(int u, int v) { if(!g[u].count(v)) return 0; g[u].erase(v), g[v].erase(u); vis.assign(n, 0); deque<int> q; q.push_back(u); vis[u] = 1; while(!q.empty()){ int w = q.front(); q.pop_front(); if(v == w) return 0; for(int x : g[w]) if(!vis[x]) vis[x] = 1, q.push_back(x); } g[u].insert(v), g[v].insert(u); return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...