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 "game.h"
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1505;
int n;
int adj[maxn][maxn];
bool vis[maxn];
void dfs(int u) {
vis[u] = true;
for (int i=0;i<n;i++) if (adj[u][i] && !vis[i]) dfs(i);
}
void initialize(int N) {
n = N;
for (int i=0;i<n;i++) for (int j=0;j<n;j++) adj[i][j] = 1;
}
int hasEdge(int u, int v) {
adj[u][v] = adj[v][u] = 0;
for (int i=0;i<n;i++) vis[i] = false;
dfs(0);
for (int i=0;i<n;i++) if (!vis[i]) {
adj[u][v] = adj[v][u] = 1;
return true;
}
return false;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |