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;
#define rep(i,a,b) for (int i = (a); i <= (b); i++)
#define repa(i,a,b) for (int i = (a); i >= (b); i--)
#define lli long long int
#define debugsl(a) cout << #a << " = " << a << ", "
#define debug(a) cout << #a << " = " << a << endl
#define MAX 1500
lli N,aristas[MAX+2][MAX+2],salidas[MAX+2];
void comunica(lli pos) {
rep(i,0,N-1) {
if (aristas[pos][i] == 0) {
aristas[pos][i] = -1;
aristas[i][pos] = -1;
salidas[i]--;
if (salidas[i] == 1) comunica(i);
}
}
}
void initialize(int n) {
N = n;
rep(i,0,n-1) {salidas[i] = n-1; aristas[i][i] = 1;}
}
int hasEdge(int u, int v) {
if (aristas[u][v] == -1) {
aristas[u][v] = 1;
aristas[v][u] = 1;
return 1;
}
aristas[u][v] = 1;
aristas[v][u] = 1;
salidas[u]--;
salidas[v]--;
if (salidas[u] == 1) comunica(u);
if (salidas[v] == 1) comunica(v);
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... |