# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1062160 | andrei_iorgulescu | Game (IOI14_game) | C++14 | 1 ms | 344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "game.h"
#warning That's not FB, that's my FB
using namespace std;
int n;
int sz[1505], t[1505], nre[1505];
void initialize(int N)
{
n = N;
for (int i = 1; i <= n; i++)
t[i] = i, sz[i] = 1, nre[i] = 0;
}
int par(int x)
{
if (x == t[x])
return x;
return par(t[x]);
}
void join(int u, int v)
{
u = par(u);
v = par(v);
if (u == v)
{
nre[u]++;
return;
}
if (sz[u] < sz[v])
swap(u,v);
sz[u] += sz[v];
nre[u] += nre[v] + 1;
t[v] = u;
}
int hasEdge(int u, int v)
{
u++;
v++;
join(u,v);
int xx = par(u);
if (nre[xx] == sz[xx] * (sz[xx] - 1) / 2)
return 1;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |