Submission #162687

#TimeUsernameProblemLanguageResultExecution timeMemory
162687RoundMangoGame (IOI14_game)C++14
0 / 100
2 ms376 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; int v, u, n, path[1500][1500], sz[1500], par[1500], a[1500]; int find(int v) { if (v == par[v]) return v; return par[v] = find(par[v]); } void stunion(int x, int y) { if (sz[x] < sz[y]) swap(x,y); sz[x] += sz[y]; par[y] = x; for (int j = 0; j < n; j++) { if (j != x && par[j] == j) { path[j][x] += path[j][y]; path[x][j] = path[j][x]; } } } void initialize(int n) { for (int i = 0; i < n; i++) { par[i] = i; sz[i] = 1; } for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) path[i][j] = 1; } int hasEdge(int u, int v) { v = find(v); u = find(u); if (path[u][v] == 1) { stunion(v,u); return 1; } else { path[v][u]--; path[u][v]--; return 0; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...