Submission #162643

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