Submission #813594

#TimeUsernameProblemLanguageResultExecution timeMemory
813594LiudasGame (IOI14_game)C++17
42 / 100
1087 ms12732 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; static const int buf_size = 4096; vector<set<int>> tree; int s; void initialize(int N){ tree.assign(N, {}); s = N; for(int i = 0; i < N; i ++){ for(int j = i + 1; j < N; j ++){ tree[i].insert(j); tree[j].insert(i); } } } void dfs(int head, vector<set<int>> &tree, vector<bool> &vis, int &c){ c ++; vis[head] = true; for(int i : tree[head]){ if(!vis[i]){ dfs(i, tree, vis, c); } } } int hasEdge(int u, int v){ tree[u].erase(v); tree[v].erase(u); vector<bool> vis(s, false); int c = 0; dfs(0, tree, vis, c); if(c == s){ return 0; } else{ tree[u].insert(v); tree[v].insert(u); return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...