#include <bits/stdc++.h>
#include "game.h"
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
const ll n_ = 2e3 + 100;
ll checked[n_], con[n_][n_], N;
void initialize(int n) {
N = n;
memset(con, -1, sizeof(con));
}
bool go(ll s) {
vector<ll> checked(N + 1);
queue<ll> q;
ll ret = 0;
q.push(s);
checked[s] = 1;
while (q.size()) {
ll cur = q.front();
ret++;
q.pop();
for (int i = 1; i <= N; i++) {
if (checked[i] || con[cur][i] == 1) continue;
checked[i] = 1;
q.push(i);
}
}
return ret == N;
}
int hasEdge(int u, int v) {
con[u][v] = 0;
if (!go(u) || !go(v)) {
con[u][v] = 1;
}
return con[u][v];
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |