Why this solution passed ? [Codeforces Round #669 (Div. 2) , Problem A ]

Que : “https://codeforces.com/contest/1407/problem/A
solution : “Submission #92287594 - Codeforces

Solution code(in short) -

while(t--) {
    lli n;
    cin>>n;
    lli a[n];
    scanarr(a,n);
    lli cntone = 0 , cntzero= 0;
    loop(i,n)
    {
        cntone += (a[i]==1);
        cntzero += (a[i]==0);
    }
    if(cntone>(n/2))
    {
        cntone -= (cntone%2);
        print(cntone);
        loop(i,cntone)
            cout<<1<<" ";
        
    }
    else
    {
        print(n/2);
        loop(i,n/2)
            cout<<0<<" ";
    }
    print("");
  }

on test case
1
4
0 1 1 0

It gives -

2
0 0

but isn’t this wrong , bcz in question , they said The elements that you remove don’t have to be consecutive.

@galencolin

This doesn’t mean they can’t be consecutive.

to fr likha kyu tha :sob: , very ambiguous , bcz in first attempt I thought above solution but as question says not to be consecutive then dropped this :frowning_face:

This means they don’t necessarily have to continuous.

Google translate says a lot of other things as well :joy:
Never Trust!

2 Likes

Lol rofl lmao :rofl::rofl:

:sob: Due to this , I got 2 penalty and submit after 1.5 hr , also I m pretty sure due to this the submission is only 8.5k warna 20k+ hote hai .

1 Like

It says-
The elements that you remove don't have to be consecutive.
It never said-
The elements that you remove should not be consecutive.

and the funny part is , If the above solution fails and I ask why this fails then all come and tell , ae english nhi aati kya , it is mentioned that not to be consecutive :rofl:

Bro can u share resources to learn english , specially for CF problems :sweat_smile:

https://www.woodwardenglish.com/lesson/must-not-do-not-have-to/#:~:text=Don’t%20have%20to%20means,you%20don’t%20want%20to.
HERE

1 Like