Submission #432469

#TimeUsernameProblemLanguageResultExecution timeMemory
432469MilosMilutinovicGame (IOI14_game)C++14
0 / 100
1 ms300 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1505;

int parent[MAXN];

int root(int u) {
    return parent[u] ^ u ? parent[u] = root(parent[u]) : u;
}

void unite(int u, int v) {
    u = root(u);
    v = root(v);
    parent[u] = v;
}

int hasEdge(int u, int v) {
    return 1;
}

void initialize(int N) {
    for (int i = 0; i < N; i++)
        parent[i] = i;
    for (int i = 0; i < N; i++)
        for (int j = 0; j < N; j++)
            if (root(i) != root(j))
                if (hasEdge(i, j))
                    unite(i, j);
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...