my code

I have used the summation formula for first n numbers ,first n^2 numbers so on till first n^4 numbers .
The test case is passing but I’m getting WA.
Please can anyone help me.

Your link is just the editor link.

1 Like

you don’t need n^2 or n^4 its just pattern.
day 1- = 24
day 2- = 120
day 3- = 360
day 4- = 840

just pre compute the results

can u pls tell why this code gives WA?

The code gives segmentation even for the given sample test case in the problem. Did you even test it?

l and r both have to be inclusive. In yours if l=1 then it will be vec[r]-vec[0] so 1st day will not be included