This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
// ~ Be Name Khoda ~ //
#include "game.h"
#include <bits/stdc++.h>
//#pragma GCC optimize ("O3")
//#pragma GCC target("avx2")
//#pragma GCC optimize("unroll-loops,Ofast")
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define all(x) x.begin(), x.end()
#define fi first
#define se second
const int maxn = 1e6 + 10;
const int maxn5 = 2e3 + 10;
const int maxnt = 1.2e6 + 10;
const int maxn3 = 1e3 + 10;
const int mod = 1e9 + 7;
const ll inf = 1e18;
int n;
bool mark[maxn5], av[maxn5][maxn5];
void dfs(int v){
mark[v] = true;
for(int i = 0; i < n; i++) if(!mark[i] && av[v][i])
dfs(i);
}
void initialize(int nn) {
n = nn;
memset(av, true, sizeof av);
}
int hasEdge(int u, int v){
av[u][v] = av[v][u] = false;
memset(mark, false, sizeof mark);
dfs(0);
bool ok = true;
for(int i = 0; i < n; i++)
ok &= mark[i];
if(ok)
return 0;
av[u][v] = av[v][u] = true;
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |