# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1155080 | alexdd | Game (IOI14_game) | C++20 | 0 ms | 328 KiB |
#include "game.h"
#include<bits/stdc++.h>
using namespace std;
int cntcomp;
int father[1505];
vector<int> comp[1505];
void initialize(int n)
{
for(int i=0;i<n;i++)
{
father[i] = i;
comp[i].push_back(i);
}
cntcomp=n;
}
int hasEdge(int u, int v)
{
if(father[u]==father[v])
return 1;
if(cntcomp > 2)
{
u = father[u];
v = father[v];
if((int)comp[v].size() > (int)comp[u].size())
swap(u,v);
vector<int> aux = comp[v];
comp[v].clear();
for(int x:aux)
{
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |