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<bits/stdc++.h>
using namespace std;
#include "game.h"
const int N = 1510;
bool mark[N][N], vis[N];
int n;
void initialize(int m) {
n = m;
for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) mark[i][j] = 1;
vis[0] = 1;
}
int hasEdge(int u, int v) {
mark[u][v] = mark[v][u] = 0;
queue<int> q;
for(int i = 1; i < n; i++) vis[i] = 0;
q.push(0);
while (!q.empty()) {
int u = q.front(); q.pop();
for(int v = 0; v < n; v++) if (!vis[v] && mark[u][v]) {
q.push(v); vis[v] = 1;
}
}
for(int i = 0; i < n; i++) if (!vis[i]) {
mark[u][v] = mark[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... |