Submission #577654

#TimeUsernameProblemLanguageResultExecution timeMemory
577654BelguteiGame (IOI14_game)C++17
0 / 100
1 ms212 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define ff first #define ss second #define pb push_back #define mk make_pair int n; map<int,int> mp; int parent[2000]; int num_child[2000]; vector<pair<int,int > > p; int find(int node) { if(parent[node] == node) return node; return parent[node] = find(parent[node]); } void initialize(int N) { n = N; for(int i = 0; i < n; i ++) { parent[i] = i; num_child[i] = 1; } } int hasEdge(int u, int v) { int X = find(u); int Y = find(v); if(p.size() == 1) { if(p[0].ff == u || p[0].ss == u || p[0].ff == v || p[0].ss == v) { p.pb({u,v}); return 0; } } if(X == Y) return 1; if(num_child[X] + num_child[Y] == n) return 0; p.pb({u,v}); parent[X] = Y; num_child[Y] += num_child[X]; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...