This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |