Submission #77380

#TimeUsernameProblemLanguageResultExecution timeMemory
77380shoemakerjoGame (IOI14_game)C++14
100 / 100
640 ms160404 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define maxn 1505 int conn[maxn][maxn]; int par[maxn]; int findset(int u) { if (par[u] == u) return u; return par[u] = findset(par[u]); } int N; void initialize(int n) { N = n; for (int i = 0; i < n; i++) { par[i] = i; for (int j = 0; j < n; j++) { conn[i][j] = 1; } } } int hasEdge(int u, int v) { u = findset(u); v = findset(v); if (u == v) return 0; if (conn[u][v] == 1) { par[v] = u; for (int i = 0; i < N; i++) { if (i != u && i != v) { conn[u][i] = conn[u][i] + conn[v][i]; conn[i][u] = conn[u][i]; } } return 1; } conn[u][v]--; conn[v][u]--; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...