Submission #513724

#TimeUsernameProblemLanguageResultExecution timeMemory
513724status_codingGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h" #include <bits/stdc++.h> int n; int par[2005]; int nr[2005][2005]; int dsu_par(int x) { if(par[x]!=x) par[x]=dsu_par(par[x]); return par[x]; } void dsu_merge(int x, int y) { par[y]=x; for(int i=1;i<=n;i++) { nr[x][i] += nr[y][i]; nr[i][x] = nr[x][i]; } } void initialize(int N) { n = N; for(int i=1;i<=n;i++) { par[i]=i; for(int j=1;j<=n;j++) nr[i][j]=1; } } int hasEdge(int x, int y) { x = dsu_par(x+1); y = dsu_par(y+1); if(x == y) return true; if(cnt[x][y] == 1) { dsu_merge(x, y); return true; } nr[x]--; nr[y]--; return false;

Compilation message (stderr)

game.cpp: In function 'int hasEdge(int, int)':
game.cpp:47:8: error: 'cnt' was not declared in this scope; did you mean 'int'?
   47 |     if(cnt[x][y] == 1)
      |        ^~~
      |        int
game.cpp:53:9: error: lvalue required as decrement operand
   53 |     nr[x]--;
      |     ~~~~^
game.cpp:54:9: error: lvalue required as decrement operand
   54 |     nr[y]--;
      |     ~~~~^
game.cpp:55:17: error: expected '}' at end of input
   55 |     return false;
      |                 ^
game.cpp:40:1: note: to match this '{'
   40 | {
      | ^