제출 #332122

#제출 시각아이디문제언어결과실행 시간메모리
332122zggf게임 (IOI14_game)C++14
15 / 100
5 ms748 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; vector<bool> tree; vector<unordered_set<int>> graf; void initialize(int n) { tree.resize(n); graf.resize(n); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(i!=j) graf[i].insert(j); } } } void dfs(int x){ int isTree= 0; for(auto it:graf[x]){ if(tree[it]) {isTree++;} } if(graf[x].size()-isTree<=1) tree[x] = true; if(!tree[x]) return; tree[x] = true; for(auto it:graf[x]){ if(!tree[it]) dfs(it); } } int hasEdge(int u, int v) { //for(int i =0;i < tree.size(); i++) cout<<tree[i]; //cout<<endl; if(tree[u]||tree[v]){ return 1; } graf[u].erase(v); graf[v].erase(u); dfs(u); dfs(v); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...