Submission #1108489

#TimeUsernameProblemLanguageResultExecution timeMemory
1108489AriadnaGame (IOI14_game)C++14
0 / 100
1 ms504 KiB
#include <bits/stdc++.h> #define fi first #define se second using namespace std; int n; vector<int> parent; vector<int> size, cnt; int ufind(int u) { if (parent[u] == u) return u; return parent[u] = ufind(parent[u]); } void ujoin(int u, int v) { u = ufind(u); v = ufind(v); parent[v] = u; size[u] += size[v]; cnt[u] += cnt[v]; } void initialize(int N) { n = N; cnt = vector<int>(n, 0); size = vector<int>(n, 1); parent = vector<int>(n); for (int i = 0; i < n; ++i) parent[i] = i; } int hasEdge(int u, int v) { int a = ufind(u), b = ufind(v); ++cnt[a]; ++cnt[b]; if (a != b) { if (cnt[a] == size[a]*(n-1) || cnt[b] == size[b]*(n-1)) return 1; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...