Help me in solving BGME problem

My issue

Hi , can someone pls tell what is it that i m doing wrong in code .

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
    long long T ;
    cin>>T;
    while(T--){
        long long N;
        cin>>N;
        vector<long long> Bucket(N);
        for(int i = 0 ; i < N ; i++){
            cin>>Bucket[i];
        }
        long long odds_and_1 = 0 , even = 0;
        for (long long i : Bucket){
            if((i%2)!=0){
                odds_and_1++;
            }
            else if ((i%2)==0)
            {
                even++;
            }
        }
        int Alice =0, Bob=0;
        if (odds_and_1%2 != 0){
            Alice++;
        }
        else if (odds_and_1%2 == 0){
            if(even>0){
                Bob++;
            }
        }
        if (Bob > Alice){
            cout<<"Bob\n";
        }
        else if (Bob == Alice){
            cout<<"draw\n";
        }
        else {
            cout<<"Alice";
        }
        }
    }

Problem Link: Bucket Game Practice Coding Problem - CodeChef

@rohitmishrarm5
here plzz refer my c++ code for better understanding of the logic

#include <bits/stdc++.h>
using namespace std;

int main() {
	// your code goes here
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int a[n];
        int cnt=0,cnt1=0;
        for(int i=0;i<n;i++)
        {
            cin>>a[i];
            if(a[i]%2!=0)
            {
                if(a[i]==1)
                cnt1++;
                else
                cnt++;
            }
        }
        if(cnt1%2==0)
        {
            if(cnt%2!=0)
            {
                cout<<"Alice";
            }
            else if(n==cnt1)
            cout<<"Draw";
            else
            cout<<"Bob";
        }
        else
        {
            if(cnt==1&&cnt+cnt1==n)
            cout<<"Draw";
            else if(cnt%2!=0)
            cout<<"Bob";
            else
            cout<<"Alice";
        }
        cout<<endl;
    }
}
1 Like

I’m new to codechef and i don’t know if this is the right category to post this thing so i’m sorry. I was solving practice problems in 500-1000 rating category i’m very comfortable upto around 700s after that i can solve few but i really couldn’t solve the rest how can i work upon only these kind of problems which i couldn’t solve and improve my problem solving abilities ? thanks in advance.
@dpcoder_007

@tech_ninja_632
keep practicing .
learn more topics that will help u to upgrade your DSA knowledge .

1 Like

can you suggest me how to find the specific topic which i’m struggling just by looking at the problem? this could be really helpful if you answer me @dpcoder_007

@tech_ninja_632
just follow any playlist available on youtube for basic knowledge .

1 Like

this is what i was looking for thank you so much TuT