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 nmax = 1500;
static int n;
//int pos[nmax + 1];
bool ok[nmax + 1][nmax + 1];
//int gr[nmax + 1], t[nmax + 1];
//int findtata (int x) {
// if (x == t[x]) return x;
// return t[x] = findtata(t[x]);
//}
void initialize(int N) {
n = N;
for (int i = 0; i < n; ++ i) {
for (int j = 0; j < n; ++ j) {
ok[i][j] = 1;
}
ok[i][i] = 0;
// pos[i] = n - 1;
}
/* for (int i = 0; i < n; ++ i) {
t[i] = i;
gr[i] = 1;
}*/
}
bool viz[nmax + 1];
void dfs (int nod) {
viz[nod] = 1;
for (int i = 0; i < n; ++ i) {
if (viz[i] == 0 && ok[nod][i] == 1)
dfs(i);
}
}
int hasEdge(int u, int v) {
// int tu = findtata(u), tv = findtata(v);
ok[u][v] = ok[v][u] = 0;
memset(viz, 0, sizeof(viz));
dfs(0);
bool flg = 1;
for (int i = 0; i < n; ++ i) {
if (viz[i] == 0) {
flg = 0;
}
}
if (flg == 0) {
ok[u][v] = ok[v][u] = 1;
return 1;
} else
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... |