I intention are not to spam this discussion forum but I need help. Its hard for to move to the next problem If I haven’t solve the current one. and I’m stuck with this problem and need help.
I’m a new to CP .
in Below I have mention my problem because No one noticing it so I’m asking again.

If you feel I’m spamming the forum just let me know I’ll delete this post.
PS: sorry for my poor english.

@shlok_dhara My output is also 3.
see there are 2 odd number and 1 pair odd number so my algo is showing 2+1 = 3.
three is the correct answer. right?
[1], [3], [1,3]

I don’t know vijay why u make this problem more complex …it’s easy see my approach and if u find similar to your approach then i think u also figure out where u r going wrong.

I know the editorial is available but I want to know why my answer is giving me WA in few test Cases.
if you ignore the input loop then Its pretty simple code.
See, first I find the number of odd in array or if any sub Array which has odd in its product.

loop(0, n){
len = 1;
if(arr[i]&1) {
ans++;
i++;
while(i < n && arr[i]%2 != 0){
ans++;
len++;
i++;
}
}
ans += (len*(len-1))/2;
}

Then In another loop I used two pointer technique to find out number divisible 4 and sub Array whose product is divisible by 4.
Also I told you that I put my algorithm in a test case generator and still couldn’t able to find the false test case. I compared my algo with the tester Solution.

if in a subarray there are 2 numbers which are not divisible by 4 but both are divisible by 2 than that subarray is valid
does your code account for that?

If I get any number which is divisible by 4 (or any subArray ) then any sub array which contain these number will also be divisible by 4.
For example
2 2 6 4 8
here initial two element is divisible by 4, so one pair is [2, 2] and at this instance forward is pointing to the index 1(second element), first(variable) is pointing to the index 0. So n-forward = 4 that means there are 4 pair which will be divisible by 4
[2, 2] and rest 3 are
[2, 2, 6], [2, 2, 6, 4], [2, 2, 6, 4, 8]
This is somewhat works like a two pointer technique.
btw I’m still testing my algorithm with random test generator and tried more than thousands times. and every time my output is same as tester’s Solution given in the editorial.

It seems to work fine. But there must be some minute mistake as you’re suggesting too. I’m sorry it looks a little cumbersome to find the issue. I’d suggest you to not be stuck on this for long. As the red coders advise, you should not spend more than 30 minutes on a problem (easy ones); if you can’t think of a solution, just see a hint in editorials.
(Yes, that feeling is great when you finally find the bug. But its a trivial problem and its not worth that much time. I think you can be glad of the fact that the concepts you applied were correct though your approach was different than the one in editorials.)

This could be the case but I resolve it by arr[n] = 1;
also I haven’t had any problem while comparing the result in test Case generator.
Thank you for pointing out the bug.

I think you’re right. But I spend almost a week on this problem and to be very honest I sacrifices my night for this. few of my attempt are in the mid night 1:30 AM and because of this I couldn’t able to solve the other problems also. but I think I should give up on this. btw this is pretty straight forward question. still took me this much of time. Really Feeling bad for myself. I will do better next time.