Submission #157097

#TimeUsernameProblemLanguageResultExecution timeMemory
157097InfiniteJestGame (IOI14_game)C++14
Compilation error
0 ms0 KiB
#include <iostream> #include <fstream> #include <vector> #include <queue> #include <algorithm> #include <math.h> #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; ifstream in("input.txt"); ofstream out("output.txt"); typedef long long ll; int k[1600]; int s[1600]; int p[1600][1600]; int find(int x){ while(x!=k[x])x=k[x]; return k[x]; } bool same(int a, int b){ return find(a)==find(b); } void unite(int a, int b){ a=find(a); b=find(b); if(s[a]<s[b])swap(a,b); k[b]=a; s[a]+=s[b]; for(int i=0;i<n;i++)p[a][i]+=p[b][i]; } void initialize(int n){ for(int i=0;i<n;i++){ k[i]=i; s[i]=1; } } int hasEdge(int u, int v){ u=find(u); v=find(v); if(u==v)return 1; if(p[u][v]+p[v][u]==s[u]*s[v]-1){ unite(u,v); return 1; } return 0; }

Compilation message (stderr)

game.cpp: In function 'void unite(int, int)':
game.cpp:37:17: error: 'n' was not declared in this scope
   for(int i=0;i<n;i++)p[a][i]+=p[b][i];
                 ^