Submission #421258

#TimeUsernameProblemLanguageResultExecution timeMemory
421258OzyGame (IOI14_game)C++17
15 / 100
3 ms716 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...