Submission #1095475

#TimeUsernameProblemLanguageResultExecution timeMemory
1095475HaciyevAlikGame (IOI14_game)C++14
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; const int mx = 105; int cnt[mx]; int n, comp; vector<int> par; int Find(int u) { if(par[u] < 0) return u; return par[u] = Find(par[u]); } bool uni(int u,int v) { u = Find(u); v = Find(v); if(u != v) { if(par[u] > par[v]) { swap(u,v); } par[u] += par[v]; par[v] = u; --comp; return true; } else { return false; } } void initialize(int N) { n = N; comp = n; par.resize(n); for(int i = 0; i < n; ++i) { par[i] = -1; } } int hasEdge(int u, int v) { cnt[u]++, cnt[v]++; if(cnt[u] == n - 1 || cnt[v] == n - 1) { return 1; } if(uni(u,v)) { return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...