Submission #132622

#TimeUsernameProblemLanguageResultExecution timeMemory
132622junodeveloperGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include "game.h" int par[1500], rk[1500]; int cnt[1500][1500], sz[1500]; int pn(int u){return u==par[u]?u:pn(par[u]); } void us(int a, int b) { a=pn(a), b=pn(b); if(rk[a]<rk[b]) swap(a,b); par[b]=a; sz[a]+=sz[b]; if(rk[a]==rk[b])rk[a]++; } void initialize(int n) { int i, j; for(i=0; i<n; i++) { for(j=0; j<n; j++) cnt[i][j] = 0; par[i] = i; sz[i] = 1; } } int hasEdge(int u, int v) { u=pn(u),v=pn(v); if(u==v) return 1; else if(u>v) swap(u,v); cnt[u][v]++; if(cnt[u][v]==sz[u]*sz[v]) { us(u,v); return 1; } return 0; }

Compilation message (stderr)

game.cpp: In function 'void us(int, int)':
game.cpp:9:18: error: 'swap' was not declared in this scope
  if(rk[a]<rk[b]) swap(a,b);
                  ^~~~
game.cpp: In function 'int hasEdge(int, int)':
game.cpp:27:15: error: 'swap' was not declared in this scope
  else if(u>v) swap(u,v);
               ^~~~