prog.cpp: In function ‘int solve(int, int*, int, int&)’:
prog.cpp:12:26: error: ‘max’ was not declared in this scope
ans = max(ans,tree[i]);
^
prog.cpp:21:36: error: ‘max’ was not declared in this scope
ans = max(ans,left+tree[i]+right);
^
prog.cpp: In function ‘int maxDiameterSum(int, int*)’:
prog.cpp:30:31: error: invalid conversion from ‘int*’ to ‘int’ [-fpermissive]
return solve(nodes,tree,1,&ans);
^~~~
prog.cpp:10:5: note: initializing argument 4 of ‘int solve(int, int*, int, int&)’
int solve(int n,int tree[511],int i,int& ans) {
^~~~~
prog.cpp:30:31: error: cannot bind rvalue ‘(int)(& ans)’ to ‘int&’
return solve(nodes,tree,1,&ans);
^~~~
prog.cpp: In function ‘int main()’:
prog.cpp:39:6: error: ‘ans’ was not declared in this scope
ans = -INF;
^~~