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<bits/stdc++.h>
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
using namespace std;
#include "game.h"
set<int> adj[1500];
vector<bool> vis(1500, false);
int cnt = 0;
int n;
void dfs(int x){
vis[x] = true;
cnt++;
for(auto y : adj[x]){
if(!vis[y]) dfs(y);
}
}
void initialize(int n) {
::n = n;
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
adj[j].insert(i);
adj[i].insert(j);
}
}
}
int hasEdge(int u, int v) {
vis = vector<bool>(1500, false);
cnt = 0;
adj[u].erase(v);
adj[v].erase(u);
dfs(0);
if(cnt == n) return 0;
else{
adj[u].insert(v);
adj[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... |