이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |