제출 #249708

#제출 시각아이디문제언어결과실행 시간메모리
249708muhammad_hokimiyon게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include "game.h" #include <bits/stdc++.h> using namespace std; const int N = 2000; int n1; int cnt; int r = 0; int a[N]; int get( int x ) { return (p[x] == x ? x : p[x] = get(p[x])); } void initialize(int n) { n1 = n; cnt = n; for( int i = 1; i <= n; i++ )p[i] = i; } int hasEdge(int u, int v) { u += 1 , v += 1; r += 1; if( r == n1 * (n1 - 1) / 2 )return 1; int x = get(u); int y = get(v); if( x == y )return 1; if( cnt == 2 )return 0; cnt -= 1; return 1; }

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

game.cpp: In function 'int get(int)':
game.cpp:15:13: error: 'p' was not declared in this scope
     return (p[x] == x ? x : p[x] = get(p[x]));
             ^
game.cpp: In function 'void initialize(int)':
game.cpp:22:34: error: 'p' was not declared in this scope
     for( int i = 1; i <= n; i++ )p[i] = i;
                                  ^