problem: link text

my solution : https://www.codechef.com/viewsolution/15175564

getting right answers in local ide but shows wrong answer in codechef.

can anybody help?

problem: link text

my solution : https://www.codechef.com/viewsolution/15175564

getting right answers in local ide but shows wrong answer in codechef.

can anybody help?

for(int k = j + 1; k < s ; k++)

{

tr[i] = tr[i] + pow(2,s-l)*arr[j]*arr[k];

l++;

}

You think pow function can accurately handle calculating large numbers like {2}^{{10}^{5}}? It will overflow, and this is making you have wrong answer. Try googling the trick of “Fast exponentiation” to calculate such large numbers %m in logN time.