Help me in solving CO92JUDG problem

My issue

I checked this code with many test cases and they provide me the expected answer but, when I submit the code its giving me a WA error why?

My code

#include <stdio.h>

int main(void) {
	int t;
	scanf("%d",&t);
	while(t--){
	    int n,sum1=0,sum2=0,max1=0,max2=0;
	    scanf("%d",&n);
	    int a[n],b[n];
	    for(int i=0;i<n;i++){
	        scanf("%d",&a[i]);
	        if(a[i]>max1){
	            max1=a[i];
	        }
	    }
	    for(int i=0;i<n;i++){
	        scanf("%d",&b[i]);
	        if(b[i]>max2){
	            max2=b[i];
	        }
	    }
        int alice=0,bob=0;
        for(int i=0;i<n;i++){
            if(a[i]<max1){
                alice+=a[i];
            }
            if(b[i]<max2){
                bob+=b[i];
            }
        }
	    
	    if(alice==bob){
	        printf("draw \n");
	    }
	    else if(alice<bob){
	        printf("alice \n");
	    }
	    else{
	        printf("bob \n");
	    }
	  
	    
	    
	}
	return 0;
}


Problem Link: CO92JUDG Problem - CodeChef

@s_madheshwaran
your code will fail for the case which will have multiple max values .
like 1 2 3 3 3 and 1 2 1 3 4
in this BOB will win but your code will print alice.

1 Like