제출 #132622

#제출 시각아이디문제언어결과실행 시간메모리
132622junodeveloper게임 (IOI14_game)C++14
컴파일 에러
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; }

컴파일 시 표준 에러 (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);
               ^~~~