Submission #171712

#TimeUsernameProblemLanguageResultExecution timeMemory
171712Nodir_BobievGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
# include <bits/stdc++.h> # define FILE using namespace std; int n,cn[2000][2000]; int p[2000], sz[2000]; int get( int x ){ if( p[x] == x )return x; else return p[x] = get( p[x] ); } void unin( int x, int y ){ x = get( x ); y = get( y ); p[x] = y; sz[y] += sz[x]; for( int i = 0; i < n; i ++ ){ cnt[y][i] += cnt[x][i]; cnt[i][y] += cnt[x][i]; } } void initialize( int m ){ n = m; for( int i = 0; i < n; i ++ ){ p[i] = i; sz[i] = 1; } } bool hasEdge( int u, int v ){ int x = get( u ); int y = get( v ); if( sz[x] * sz[y] - cnt[x][y] == 1 ){ unin( u,v ); return true; } return false; } /* int main(){ # ifdef FILEs freopen( "input.txt", "r", stdin ); freopen( "output.txt", "w", stdout ); # endif ios_base::sync_with_stdio(false); } */

Compilation message (stderr)

game.cpp: In function 'void unin(int, int)':
game.cpp:19:3: error: 'cnt' was not declared in this scope
   cnt[y][i] += cnt[x][i];
   ^~~
game.cpp:19:3: note: suggested alternative: 'cn'
   cnt[y][i] += cnt[x][i];
   ^~~
   cn
game.cpp: In function 'bool hasEdge(int, int)':
game.cpp:33:22: error: 'cnt' was not declared in this scope
  if( sz[x] * sz[y] - cnt[x][y] == 1 ){
                      ^~~
game.cpp:33:22: note: suggested alternative: 'cn'
  if( sz[x] * sz[y] - cnt[x][y] == 1 ){
                      ^~~
                      cn