Help me in solving CS2023_STK problem

My issue

my approach is that i find the sum of the arrays and then compare with if conditions but my 1 output is wrong

My code

#include <iostream>
using namespace std;

int main() {
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        int a[n];
        int b[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
            cin>>b[i];
        }
        int omsum=0;
        int addysum=0;
        for(int i=0;i<n;i++){
            omsum=omsum+a[i];
            addysum=addysum+b[i];
        }
         if(omsum>addysum)
        cout<<"om"<<'\n';
       else  if(omsum=addysum)
        cout<<"draw"<<'\n';
         
        else
        cout<<"addy"<<'\n';
    }
	// your code goes here
	return 0;
}

Learning course: Arrays using C++
Problem Link: CodeChef Streak Practice Problem in - CodeChef

@techno_628
refer the following solution

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

int main() 
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        int A[n],B[n];
        
        int max1=0, max2=0;
        
        for(int i=0; i<n; i++)
        {
            cin>>A[i];
        }
        
        for(int i=0; i<n; i++)
        {
            cin>>B[i];
        }
        
        
        int leng1=0;
        int leng2=0;
        
        for(int i=0; i<n; i++)
        {
            if(A[i]!=0)
                leng1++;
            
            
            else if(A[i]==0)
                leng1=0;
                
            if(leng1>max1)
                max1=leng1;
            
        }
        
        for(int i=0; i<n; i++)
        {
            if(B[i]!=0)
            {
                leng2++;
            }
            
            else if(B[i]==0)
                leng2=0;
                
            if(leng2>max2)
                max2=leng2;
        }
        
        
        if(max1>max2)
            cout<<"Om"<<endl;
            
        else if(max2==max1)
            cout<<"Draw"<<endl;
            
        else if(max2>max1)
            cout<<"Addy"<<endl;
        
    }
	return 0;
}