Submission #513491

#TimeUsernameProblemLanguageResultExecution timeMemory
513491status_coding게임 (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h"
#include <bits/stdc++.h>

int par[2005];
int nr[2005];

int dsu_par(int x)
{
    if(par[x]!=x)
        par[x]=dsu_par(par[x]);
    return par[x];
}
void dsu_merge(int x, int y)
{
    par[y]=x;
    nr[x]+=nr[y]-2;
}

void initialize(int n)
{
    for(int i=1;i<=n;i++)
    {
        par[i]=i;
        nr[i]=n-1;
    }
}

bool hasEdge(int x, int y)
{
    x = dsu_par(x+1);
    y = dsu_par(y+1);

    if(x == y)
        return true;

    if(nr[x]==1 || nr[y]==1)
    {
        dsu_merge(x, y);
        return true;
    }

    return false;
}

Compilation message (stderr)

game.cpp:28:6: error: ambiguating new declaration of 'bool hasEdge(int, int)'
   28 | bool hasEdge(int x, int y)
      |      ^~~~~~~
In file included from game.cpp:1:
game.h:5:5: note: old declaration 'int hasEdge(int, int)'
    5 | int hasEdge(int u, int v);
      |     ^~~~~~~