제출 #417999

#제출 시각아이디문제언어결과실행 시간메모리
417999T0p_게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include "game.h"
#include <bits/stdc++.h>
using namespace std;

int n, edge, edge_not;
int deg_not[1505];

int fp(int u) 
{
	return (u == pa[u]) ? u : pa[u] = fp(pa[u]);
}

void initialize(int N)
{
	n = N;
	for(int i=0 ; i<n ; i++) pa[i] = i;
	edge = n-1;
	edge_not = (n*(n-1))/2 - edge;
}

int hasEdge(int u, int v)
{
    if(edge_not > 0 && deg_not[u]+1 != n-1 && deg_not[v]+1 != n-1)
    {
    	edge_not--;
    	deg_not[u]++;
    	deg_not[v]++;
    	return 0;
    }
    else if(edge > 0)
    {
    	edge--;
    	return 1;
    }
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'int fp(int)':
game.cpp:10:15: error: 'pa' was not declared in this scope
   10 |  return (u == pa[u]) ? u : pa[u] = fp(pa[u]);
      |               ^~
game.cpp: In function 'void initialize(int)':
game.cpp:16:27: error: 'pa' was not declared in this scope
   16 |  for(int i=0 ; i<n ; i++) pa[i] = i;
      |                           ^~