제출 #162702

#제출 시각아이디문제언어결과실행 시간메모리
162702RoundMango게임 (IOI14_game)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "game.h" using namespace std; int path[1500][1500], sz[1500], par[1500], a[1500]; int find(int x) { if (x == par[x]) return x; return par[x] = find(par[x]); } void stunion(int x, int y) { if (sz[x] < sz[y]) swap(x,y); sz[x] += sz[y]; par[y] = x; for (int j = 0; j < n; j++) { if (j != x && par[j] == j) { path[j][x] += path[j][y]; path[x][j] = path[j][x]; } } } void initialize(int n) { for (int i = 0; i < n; i++) { par[i] = i; sz[i] = 1; } for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) path[i][j] = 1; } int hasEdge(int u, int v) { v = find(v); u = find(u); if (path[u][v] == 1) { stunion(v,u); return 1; } else { path[v][u]--; path[u][v]--; return 0; } }

컴파일 시 표준 에러 (stderr) 메시지

game.cpp: In function 'void stunion(int, int)':
game.cpp:13:22: error: 'n' was not declared in this scope
  for (int j = 0; j < n; j++) {
                      ^