My code is giving WA pls help

https://www.codechef.com/viewsolution/36073100
I hv used sliding window for each power of 2 number of elements as only 9 and 1 can make a 10 so lenght of array should be even.
but i dont knw why its giving WA.

1 Like

1
4
900000000 100000000 100000000 100000000

Your ans =1
Correct ans=3

If the array consists of 10 elements of 9 * 10^8 then sum will be 9 * 10^9 . Which is a required subarray, you are calculating only for (9+1), but other cases like 10 times 9 * 10^8 are also possible.

corrrect answer should be 1 only its subarrays only 1 and 2 can form that

https://www.codechef.com/viewsolution/36079554
Bro i hv checked that too nw then also WA pls help