#include "game.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll N = 1500 + 100;
int n;
bool pred[N][N], has[N][N];
int cnt[N];
void initialize(int g) {
n = g;
for(int i = 0; i < n; i++){
cnt[i] = n - 1;
}
}
void dfs(int v){
cnt[v] = 0;
for(int i = 0; i < n; i++){
if(pred[i][v] == true || i == v) continue;
has[i][v] = has[v][i] = true;
pred[i][v] = pred[v][i] = true;
cnt[i]--;
if(cnt[i] == 1) dfs(i);
}
}
int hasEdge(int u, int v) {
if(pred[u][v]) return has[u][v];
pred[u][v] = true;
pred[v][u] = true;
cnt[v]--;
cnt[u]--;
if(cnt[v] == 1) dfs(v);
if(cnt[u] == 1) dfs(u);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |