ARRGAME - Editorial

this hurts bad, really bad, did the same

2 Likes

https://www.codechef.com/viewsolution/37286779

I don’t understand why middle 2 testcases go WA, is there a bug in the code or a faulty testcase?

2 Likes

else if ((m) / 2 < m2)
Try chaging that to m <= 2*m2.

Where are the editorial of other question? Please upload them too :slightly_smiling_face: :slightly_smiling_face: :slightly_smiling_face:

1 Like

try changing that to m<=2*m2

https://www.codechef.com/viewsolution/37287301

Help, i wasted my entire time trying to get that 1 subtask right but i can’t figure out how

Can someone point out the problem in this CodeChef: Practical coding for everyone

https://www.codechef.com/viewsolution/37271549

I am unable to find any test case for which my solution is wrong .Can anyone plz help me by finding any mistake or giving any testcase .

Not working bro, m is odd so = doesn’t matter

That’s weird. When I made the change, it worked.

try this
1
11
1 0 0 0 1 0 0 0 0 01
ans-No

I spent almost 2 hrs on this problem.Just missed by the margin.

My solution: CodeChef: Practical coding for everyone

please can someone help with the code.

#include
#include
#include
using namespace std;
int main(){
int t;
cin>>t;
while(t–){
int n;
vector v;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[n];
}
for(int i=0;i<n;i++){
if(a[i]==0){
int j=i,size=0;
while(a[j]==0&&j<n){
size++;
j++;

		}	
		i=j;
		v.push_back(size);
	}
}
if(v.size()==0){
	cout<<"No"<<endl;
}
else{

if(v.size()==1){
	if(v[0]%2!=0){
		cout<<"Yes"<<endl;
	}
	else
	cout<<"No"<<endl;
}
else{
	sort(v.begin(),v.end());
	int i=v.size()-1;
	if(v[i]%2==1&&(v[i-1]<(v[i]+1)/2))
	{
		cout<<"Yes"<<endl;
	}
	else
	cout<<"No"<<endl;
}

}
}

}

1
11
1 0 0 0 0 0 1 0 0 0 1

Your code gives Yes, answer should be no. :slight_smile:

1 Like

ELOMAX was super easy ! Just implement it

1 Like

Thanks! Got it finally

Is it just doing what the problem statement says?

https://www.codechef.com/viewsolution/37247407

why is this submission wrong?

Try out this case:
1
11
1 0 0 0 0 0 1 0 0 0 1

1 Like

CodeChef: Practical coding for everyone still wrong?
can you tell me where do i need to make a change