The code I have written has the correct logic, but it executes the program one extra time and outputs draw for one extra time. Can someone please help me and check the code?
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int om[n],addy[n];
for(int i=0;i<n;i++){
cin>>om[i];
}
for(int i=0;i<n;i++){
cin>>addy[i];
}
int i,count1=0,count2=0,temp1=0,temp2=0;
for(i=0;i<n;i++){
if(om[i] != 0){
count1++;
}
if(om[i] == 0){
if(count1 >= temp1){
temp1 = count1;
}
count1 = 0;
}
}
for(i=0;i<n;i++){
if(addy[i] != 0){
count2++;
}
if(addy[i] == 0){
if(count2 >= temp2){
temp2 = count2;
}
count2 = 0;
}
}
if(temp1 > temp2){
cout<<"OM"<<endl;
}
if(temp1 < temp2){
cout<<"ADDY"<<endl;
}
else {
cout<<"DRAW"<<endl;
}
}
}