I am trying to solve this problem … but the algorithm i implement gives TLE

This is what i tried to implement => https://www.codechef.com/viewplaintext/9848187

Please provide solution.

I am trying to solve this problem … but the algorithm i implement gives TLE

This is what i tried to implement => https://www.codechef.com/viewplaintext/9848187

Please provide solution.

As you have requested only solution then here you go

sum=0;array[];

for(i=0;i < n;i++){

sum+=array[i];

}

answer= sum*power(2,n-1);

Can you please point out mistake in this algo => https://www.codechef.com/viewsolution/9860653

Seems i implemented what you said

http://codeforces.com/blog/entry/13964?

look at this same question has been asked and candidate master answered the same.