Help me in solving DICENUM problem

My issue

hey anyone can help me, i was trying to solve this problem and get the exact output and input, but my code just failed to submit

My code

#include <iostream>
using namespace std;

int maxDice(int array[3]){
    int max = 2, min = 0, x, d;
    int n = 3;
    d = n/2*(2+n-1);
    for (int i = 0; i<d; i++){
        if (array[max] > array[min]){
            x = array[min];
            array[min] = array[max];
            array[max] = x;
            min++;
        } else if (array[min] > array[max]){
            max--;
            min = 0;
        }
    }
    return (array[0]*10+array[1])*10+array[2];
}
int main() {
	int T;
    cin >> T;
    for (int i = 0; i < T; i++){
        int a[3], b[3], d, e;
        for (int u=0;u<3;u++){
            cin >> a[u];
        }
        for (int u=0;u<3;u++){
            cin >> b[u];
        }
        d = maxDice(a);
        e = maxDice(b);
        if(d > e){
            cout << "Alice" << endl;
        } else if (d < e){
            cout << "Bob" << endl;
        } else {
            cout << "Tie" << endl;
        }
    }
	return 0;
}

Problem Link: DICENUM Problem - CodeChef

@iorival
plzz refer my solution .
I have implemented it in much simpler way.

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

int main() {
	// your code goes here
	int t;
	cin>>t;
	while(t--)
	{
	    int a[3],b[3];
	    for(int i=0;i<3;i++)
	    {
	        cin>>a[i];
	    }
	    for(int i=0;i<3;i++)
	    {
	        cin>>b[i];
	    }
	    sort(a,a+3);
	    sort(b,b+3);
	    string ans="Tie";
	    for(int i=2;i>=0;i--)
	    {
	        if(a[i]>b[i]){
	            ans="Alice";
	            break;
	        }
	        else if(b[i]>a[i])
	        {
	            ans="Bob";
	            break;
	        }
	    }
	    cout<<ans<<endl;
	}
	return 0;
}