1 solutions

  • 0
    @ 2024-3-30 21:21:30
    #include <iostream>
    #include <cmath>
    #include <algorithm>
    #include <cstring>
    #define int long long
    #define endl '\n'
    #define QAQ ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
    using namespace std;
    const int N=1e5+5;
    bool cmp(int a,int b)
    {
        return a>b;
    }
    void solve()
    {
        int n,sum1=0,sum2=0;
        cin>>n;
      	int a[n+5];
        for(int i=1;i<=n;i++)
        {
            int x;
            cin>>x;
            a[i]=x;
        }
        sort(a+1,a+n+1,cmp);
        for(int i=1;i<=n;i++)
        {
            if(i%2&&a[i]%2==0)
                sum1+=a[i];
            else if(i%2==0&&a[i]%2)
                sum2+=a[i];
        }
        if(sum1>sum2)
            cout<<"Alice\n";
        else if(sum1<sum2)
            cout<<"Bob\n";
        else
            cout<<"Tie\n";
        
    }
    signed main()
    {
        QAQ;
        int t=1;
        cin>>t;
        while(t--)
            solve();
        
        
        
        return 0;
    }
    

    Information

    ID
    6972
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    9
    Tags
    (None)
    # Submissions
    80
    Accepted
    9
    Uploaded By