-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathD.cpp
More file actions
50 lines (49 loc) · 844 Bytes
/
D.cpp
File metadata and controls
50 lines (49 loc) · 844 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include<bits/stdc++.h>
using namespace std;
bool gr(long long a,long long b)
{
return a>b;
}
int main()
{
long long t,n;
cin>>t;
while(t--)
{
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n,gr);
long long c1=0,c2=0;
for(int i=0;i<n;i++)
{
if(i%2==0)
{
if(a[i]%2==0)
{
c1+=a[i];
}
}
else
{
if(a[i]%2!=0)
{
c2+=a[i];
}
}
}
if(c1>c2)
cout<<"Alice";
else if(c2>c1)
cout<<"Bob";
else
{
cout<<"Tie";
}
cout<<endl;
}
return 0;
}