ARRGAME - Editorial

Your temp variable just stores the count of zeros in last zero segment. It is fine for Sub-task 1 but it actually makes no sense. I would suggest you to read editorial ^^.

Try this case:
1
13
1 0 0 0 1 0 0 0 1 0 0 0 1

Sorry that i cannot point out the mistake in your code. if you could explain the logic then i might be able to help.

1
10
1 0 0 1 0 0 0 0 0 1

Your code giving wrong answer for this

ok, here it goes
i added all the zero lengths into my multiset.

then i took the largest and second largest then checked if :
( largest >> 1 ) > (second_largest) cout << "no"
this is previous wrong after your test case i updated it to
( largest + 1 >> 1) > (second_larget cout << "no"

rest is quite same to editorial if largerst is odd cout << “YES” else “no”

Shouldn’t > be < here?

i am seeing that now, today was not a good day i guess :(. thankyou for your help.
AC

1
4
0 0 0 1

Your code gives wrong answer for this

1 Like

1
7
1 0 1 0 0 0 1

Your code gives wrong answer for this case

OMG thank you!!
Doesn’t the constraints say A1 = An = 1 though?

1 Like

You are correct. I am sorry I ignored the constraint, although my code managed that.
You can try
1
5
1 0 1 0 1
I am guessing this part of your code caused the error

if(zerocount == 2)
{
if(n%2 == 0)
cout << “No\n”;
else
cout << “Yes\n”;
}

1 Like

what does “games” mean in prerequisite ?

I want to know time complexity of my code. I used two loop and solution should be in O(N).
Here is my code solution

Yeah you can check my solution i just implemented everything and it was 100pts

1 Like

O(NlogN) as U have used sort() function…

Cool, I thought that I’d get TLE so I didn’t try. That was stupid.

1 Like

Yeah , that makes sense. Thanks again

Thanks, I am thinking about inner while loop. Is it less then logn?

Somebody please help ! Idk whats wrong with the code… the logic though is perfect.
https://www.codechef.com/viewsolution/37291601

Thank You so much Bro

Your code is wrong for n=1… Please check at input

1
1
0
Here answer is yes but yours gives No…
Values of m and m2 remains same while m should be 1…correct it