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>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
typedef int ll;
#define MAX 1900
ll mp[MAX][MAX];
ll vis[MAX];
ll N;
queue<ll> q;
void bfs(ll x) {
ll i;
q.push(x);
ll v;
while (!q.empty()) {
v = q.front();
q.pop();
vis[v] = 1;
for (i = 1; i <= N; i++) if (mp[v][i] && !vis[i]) q.push(i), vis[i] = 1;
}
}
void initialize(int n) {
N = n;
ll i, j;
for (i = 0; i < n; i++) for (j = 0; j < n; j++) mp[i][j] = 1;
}
int hasEdge(int u, int v) {
ll i;
while (!q.empty()) q.pop();
for (i = 0; i < N; i++) vis[i] = 0;
mp[u][v] = 0;
mp[v][u] = 0;
bfs(u);
if (vis[v]) return 0;
else mp[u][v] = 1, mp[v][u] = 1;
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... |