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;
bool cnc[1505][1505];
int N;
void initialize(int n) {
N = n;
for(int i = 0; i < n; i++)
for(int j = i + 1; j < n; j++)
cnc[i][j] = cnc[j][i] = 1;
}
int vis[1505], cnt;
int dfs(int node){
if(vis[node] == cnt)return 0;
vis[node] = cnt;
int ans = 1;
for(int j = 0; j < N; j++)
if(cnc[node][j] && vis[j] != cnt) {
ans += dfs(j);
}
return ans;
}
int hasEdge(int u, int v) {
cnc[u][v] = cnc[v][u] = 0;
cnt++;
if(dfs(0) != N){
cnc[u][v] = cnc[v][u] = 1;
return 1;
}
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... |