#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pi pair<int, int>
#define pl pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(),(x).end()
const int maxn=1510;
int n;
vector<vi> graph(maxn,vi(maxn,-1));
vi seen(maxn,0);
int s=0;
void initialize(int _n) {
n=_n;
}
void dfs(int cur) {
seen[cur]=1;
s++;
for (int i=0; i<n; i++) {
if (!seen[i] && graph[cur][i]!=0) {
dfs(i);
}
}
}
int hasEdge(int u, int v) {
graph[u][v]=0;
graph[v][u]=0;
fill(all(seen),0);
s=0;
dfs(0);
if (s==n) {
return 0;
}
graph[u][v]=1;
graph[v][u]=1;
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... |