this is the link of the hackerblock question named vivek homework-hachttps://hack.codingblocks.com/app/practice/1/70/problem
please find the flaw in my code
#include
#include<math.h>
using namespace std;
int main()
{
long long int n,pro=1,max=0,first,last,mid,ans,i;
cin>>n;
long long int a[n];
for(i=0;i<n;i++)
{
cin>>a[i];
pro=a[i]*pro;
}
first=0;
last=10000000001;
while(first<=last)
{
mid=(first+last)/2;
if(pow(mid,n)>pro)
{
ans=mid;
last=mid-1;
}
else
first=mid+1;
}
cout<<ans;
return 0;
}