Codeforces Round #385 (Div. 2), problem: (C) Hongcow Builds A Nation Solution in C/C++

By | 2017-04-07T22:11:47+00:00 December 18th, 2016|Categories: C/C++, Programming|Tags: , , |

#include <stdio.h> #include <string.h> int c[1005], p[1005], sz[1005], gov[1005]; int find_parent(int n) { if (p[n] == n) return n; return p[n] = find_parent(p[n]); } int get_full_size(int n) { return n * (n-1) / 2; } int main(int argc, char** argv) { int i, n, [...]