Submission #66998

#TimeUsernameProblemLanguageResultExecution timeMemory
66998CrownGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h" const int maxn = 1505; int p[maxn]; int bw[maxn][maxn]; int n; void initialize(int _n) { n = _n; for(int i = 0; i< n; i++) p[i] = i; for(int i = 0; i< n; i++) { for(int j = i+1; j< n; j++) { bw[i][j] = bw[j][i] = 1; } } } int findset(int x) { if(p[x] == x) return x; return p[x] = findset(p[x]); } void unionset(int x, int y) { int a = findset(x), b = findset(y); for(int i = 0; i< n; i++) { bw[x][i] += bw[y][i]; bw[i][x] += bw[i][y]; } } int hasEdge(int u, int v) { int x = findset(u), y = findset(v); int res = 0; assert(x != y); if(x != y && bw[x][y] == 1) res = 1; bw[x][y]--; bw[y][x]--; if(res) { unionset(x, y); } return res; }

Compilation message (stderr)

game.cpp: In function 'void unionset(int, int)':
game.cpp:30:6: warning: unused variable 'a' [-Wunused-variable]
  int a = findset(x), b = findset(y);
      ^
game.cpp:30:22: warning: unused variable 'b' [-Wunused-variable]
  int a = findset(x), b = findset(y);
                      ^
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:41:2: error: 'assert' was not declared in this scope
  assert(x != y);
  ^~~~~~
game.cpp:41:2: note: suggested alternative: 'short'
  assert(x != y);
  ^~~~~~
  short