Submission #249708

#TimeUsernameProblemLanguageResultExecution timeMemory
249708muhammad_hokimiyonGame (IOI14_game)C++14
Compilation error
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; }

Compilation message (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;
                                  ^