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;
static const int buf_size = 4096;
vector<vector<int>> tree;
int s;
void initialize(int N){
tree.assign(N, vector<int>());
s = N;
for(int i = 0; i < N; i ++){
for(int j = i + 1; j < N; j ++){
tree[i].push_back(j);
tree[j].push_back(i);
}
}
}
void dfs(int head, vector<vector<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(find(tree[u].begin(), tree[u].end(), v));
tree[v].erase(find(tree[v].begin(), tree[v].end(), u));
vector<bool> vis(s, false);
int c = 0;
dfs(0, tree, vis, c);
if(c == s){
return 0;
}
else{
tree[u].push_back(v);
tree[v].push_back(u);
return 1;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |