Submission #383104

#TimeUsernameProblemLanguageResultExecution timeMemory
383104ScarletSGame (IOI14_game)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1500; int pt[N], sz[N], e[N][N]; int find(int x) { if (x==pt[x]) return x; return pt[x] = find(pt[x]); } void unite(int a, int b) { int x = find(a); int y = find(b); if (sz[y]>sz[x]) swap(x,y); pt[y]=x; sz[x]+=sz[y]; for (int i=0;i<n;++i) { e[x][i]+=e[y][i]; e[i][x]=e[x][i]; } } int hasEdge(int u, int v) { if (find(u) == find(v)) return 1; if (e[find(u)][find(v)]==1) { unite(u,v); return 1; } return 0; } void initialize(int n) { for (int i=0;i<n;++i) { pt[i]=i; sz[i]=1; } for (int i=0;i<n;++i) for (int j=0;j<n;++j) e[i][j]=1; }

Compilation message (stderr)

game.cpp: In function 'void unite(int, int)':
game.cpp:22:20: error: 'n' was not declared in this scope
   22 |     for (int i=0;i<n;++i)
      |                    ^