0_0_20614625_28557.cpp:8:25: error: stray '#' in program
using namespace std;#define MAXN 100005vector<int>vec[MAXN];queue<int>q;int n,d[MAXN];inline double f(double a,double b){ return a * b / (a + b);}double solve(){ double ans = 0; for(int i = n - 1;i >= max(n - 100,0);i--) for(int j = n - 1;j > i;j--) ans += f(d[i],d[j]) / (pow(2.0,n - i) - (n + 1) / pow(2.0,i)); return ans;}int main(){ while(scanf("%d",&n) != EOF) { for(int i = 0;i <= n;i++)vec[i].clear(); for(int i = 1;i < n;i++) { int u; scanf("%d",&u); vec[u - 1].push_back(i); } d[0] = 1; q.push(0); while(!q.empty()) { int u = q.front(); q.pop(); for(int i = 0;i < vec[u].size();i++) { int v = vec[u][i]; d[v] = d[u] + 1; q.push(v); } } sort(d,d + n); double ans = solve(); printf("%.6f\n",ans); }}
^
0_0_20614625_28557.cpp:8:26: error: 'define' does not name a type
using namespace std;#define MAXN 100005vector<int>vec[MAXN];queue<int>q;int n,d[MAXN];inline double f(double a,double b){ return a * b / (a + b);}double solve(){ double ans = 0; for(int i = n - 1;i >= max(n - 100,0);i--) for(int j = n - 1;j > i;j--) ans += f(d[i],d[j]) / (pow(2.0,n - i) - (n + 1) / pow(2.0,i)); return ans;}int main(){ while(scanf("%d",&n) != EOF) { for(int i = 0;i <= n;i++)vec[i].clear(); for(int i = 1;i < n;i++) { int u; scanf("%d",&u); vec[u - 1].push_back(i); } d[0] = 1; q.push(0); while(!q.empty()) { int u = q.front(); q.pop(); for(int i = 0;i < vec[u].size();i++) { int v = vec[u][i]; d[v] = d[u] + 1; q.push(v); } } sort(d,d + n); double ans = solve(); printf("%.6f\n",ans); }}
^
0_0_20614625_28557.cpp:8:85: error: 'MAXN' was not declared in this scope
using namespace std;#define MAXN 100005vector<int>vec[MAXN];queue<int>q;int n,d[MAXN];inline double f(double a,double b){ return a * b / (a + b);}double solve(){ double ans = 0; for(int i = n - 1;i >= max(n - 100,0);i--) for(int j = n - 1;j > i;j--) ans += f(d[i],d[j]) / (pow(2.0,n - i) - (n + 1) / pow(2.0,i)); return ans;}int main(){ while(scanf("%d",&n) != EOF) { for(int i = 0;i <= n;i++)vec[i].clear(); for(int i = 1;i < n;i++) { int u; scanf("%d",&u); vec[u - 1].push_back(i); } d[0] = 1; q.push(0); while(!q.empty()) { int u = q.front(); q.pop(); for(int i = 0;i < vec[u].size();i++) { int v = vec[u][i]; d[v] = d[u] + 1; q.push(v); } } sort(d,d + n); double ans = solve(); printf("%.6f\n",ans); }}
^
0_0_20614625_28557.cpp: In function 'double solve()':
0_0_20614625_28557.cpp:8:291: error: 'd' was not declared in this scope
using namespace std;#define MAXN 100005vector<int>vec[MAXN];queue<int>q;int n,d[MAXN];inline double f(double a,double b){ return a * b / (a + b);}double solve(){ double ans = 0; for(int i = n - 1;i >= max(n - 100,0);i--) for(int j = n - 1;j > i;j--) ans += f(d[i],d[j]) / (pow(2.0,n - i) - (n + 1) / pow(2.0,i)); return ans;}int main(){ while(scanf("%d",&n) != EOF) { for(int i = 0;i <= n;i++)vec[i].clear(); for(int i = 1;i < n;i++) { int u; scanf("%d",&u); vec[u - 1].push_back(i); } d[0] = 1; q.push(0); while(!q.empty()) { int u = q.front(); q.pop(); for(int i = 0;i < vec[u].size();i++) { int v = vec[u][i]; d[v] = d[u] + 1; q.push(v); } } sort(d,d + n); double ans = solve(); printf("%.6f\n",ans); }}
^
0_0_20614625_28557.cpp: In function 'int main()':
0_0_20614625_28557.cpp:8:441: error: 'vec' was not declared in this scope
using namespace std;#define MAXN 100005vector<int>vec[MAXN];queue<int>q;int n,d[MAXN];inline double f(double a,double b){ return a * b / (a + b);}double solve(){ double ans = 0; for(int i = n - 1;i >= max(n - 100,0);i--) for(int j = n - 1;j > i;j--) ans += f(d[i],d[j]) / (pow(2.0,n - i) - (n + 1) / pow(2.0,i)); return ans;}int main(){ while(scanf("%d",&n) != EOF) { for(int i = 0;i <= n;i++)vec[i].clear(); for(int i = 1;i < n;i++) { int u; scanf("%d",&u); vec[u - 1].push_back(i); } d[0] = 1; q.push(0); while(!q.empty()) { int u = q.front(); q.pop(); for(int i = 0;i < vec[u].size();i++) { int v = vec[u][i]; d[v] = d[u] + 1; q.push(v); } } sort(d,d + n); double ans = solve(); printf("%.6f\n",ans); }}
^
0_0_20614625_28557.cpp:8:554: error: 'vec' was not declared in this scope
using namespace std;#define MAXN 100005vector<int>vec[MAXN];queue<int>q;int n,d[MAXN];inline double f(double a,double b){ return a * b / (a + b);}double solve(){ double ans = 0; for(int i = n - 1;i >= max(n - 100,0);i--) for(int j = n - 1;j > i;j--) ans += f(d[i],d[j]) / (pow(2.0,n - i) - (n + 1) / pow(2.0,i)); return ans;}int main(){ while(scanf("%d",&n) != EOF) { for(int i = 0;i <= n;i++)vec[i].clear(); for(int i = 1;i < n;i++) { int u; scanf("%d",&u); vec[u - 1].push_back(i); } d[0] = 1; q.push(0); while(!q.empty()) { int u = q.front(); q.pop(); for(int i = 0;i < vec[u].size();i++) { int v = vec[u][i]; d[v] = d[u] + 1; q.push(v); } } sort(d,d + n); double ans = solve(); printf("%.6f\n",ans); }}
^
0_0_20614625_28557.cpp:8:595: error: 'd' was not declared in this scope
using namespace std;#define MAXN 100005vector<int>vec[MAXN];queue<int>q;int n,d[MAXN];inline double f(double a,double b){ return a * b / (a + b);}double solve(){ double ans = 0; for(int i = n - 1;i >= max(n - 100,0);i--) for(int j = n - 1;j > i;j--) ans += f(d[i],d[j]) / (pow(2.0,n - i) - (n + 1) / pow(2.0,i)); return ans;}int main(){ while(scanf("%d",&n) != EOF) { for(int i = 0;i <= n;i++)vec[i].clear(); for(int i = 1;i < n;i++) { int u; scanf("%d",&u); vec[u - 1].push_back(i); } d[0] = 1; q.push(0); while(!q.empty()) { int u = q.front(); q.pop(); for(int i = 0;i < vec[u].size();i++) { int v = vec[u][i]; d[v] = d[u] + 1; q.push(v); } } sort(d,d + n); double ans = solve(); printf("%.6f\n",ans); }}
^
0_0_20614625_28557.cpp:8:736: error: 'vec' was not declared in this scope
using namespace std;#define MAXN 100005vector<int>vec[MAXN];queue<int>q;int n,d[MAXN];inline double f(double a,double b){ return a * b / (a + b);}double solve(){ double ans = 0; for(int i = n - 1;i >= max(n - 100,0);i--) for(int j = n - 1;j > i;j--) ans += f(d[i],d[j]) / (pow(2.0,n - i) - (n + 1) / pow(2.0,i)); return ans;}int main(){ while(scanf("%d",&n) != EOF) { for(int i = 0;i <= n;i++)vec[i].clear(); for(int i = 1;i < n;i++) { int u; scanf("%d",&u); vec[u - 1].push_back(i); } d[0] = 1; q.push(0); while(!q.empty()) {
|