Submission #282482

#TimeUsernameProblemLanguageResultExecution timeMemory
282482SaboonGame (IOI14_game)C++14
100 / 100
562 ms25336 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int maxn = 1500 + 10; int n; int par[maxn]; int adj[maxn][maxn]; int get_par(int v){ return par[v] < 0 ? v : par[v] = get_par(par[v]); } void initialize(int N){ n = N; memset(par, -1, sizeof par); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) if (i != j) adj[i][j] = 1; } int hasEdge(int u, int v){ v = get_par(v), u = get_par(u); if (adj[v][u] > 1){ adj[v][u] --, adj[u][v] --; return false; } adj[v][u] --, adj[u][v] --; for (int i = 0; i < n; i++) if (get_par(i) == i and i != v and i != u) adj[v][i] += adj[u][i], adj[i][v] += adj[i][u]; par[u] = v; return true; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...