We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
why my solution get time out in some cases. i dont think it is different from editorial solution
#include
#include
int power(long long int a)
{
long long int i,s=1;
if(a==0)
return 1;
for(i=0;i<a;i++)
{
s=(2*s)%1000000007;
}
return s;
}
int main()
{
int i,n;
long long int a[100000]={0},s=1;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
for(i=0;i<n;i++)
{
s=s*(power(a[i])+1);
s=s%1000000007;
}
s--;
printf("%lld",s);
return 0;
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Shashank and List
You are viewing a single comment's thread. Return to all comments →
why my solution get time out in some cases. i dont think it is different from editorial solution #include #include