SIGSEGV in MULTHREE

I was solving the sum MULTHREE

My Code : codechef.com/viewsolution/36118815

I have used long long as well, so why is it showing runtime error? I think my logic is correct, as I tested it with small test-cases and it gave the correct answer.

K can go upto 10^{12}. pow function will return inf when it overflow.
https://en.cppreference.com/w/cpp/numeric/math/pow

So what should I do to get AC? @ssjgz @vijju123

Crashes on the sample testcase for me.

long long A[k];

K can be as large as 10^{12} - how much stack space do you think the Codechef Online Judge has?

1 Like

Yes, so what is the solution to avoiding this? @ssjgz

Anyone?

Cool, so i came up with a code. But it doesn’t work, please can someone help me.
My code : https://www.codechef.com/viewsolution/36125642
@ssjgz

Someone please help me, I’m very anxious to finish the problem.