Submission #332122

#TimeUsernameProblemLanguageResultExecution timeMemory
332122zggfGame (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...