-
Notifications
You must be signed in to change notification settings - Fork 0
/
C.cpp
68 lines (65 loc) · 1.32 KB
/
C.cpp
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0);cin.tie(0)
long long ara[200005];
int main()
{
fastio;
long long t,n,i,mv,x;
cin>>t;
while(t--)
{
cin>>n;
for(i=0;i<n;i++)
cin>>ara[i];
sort(ara,ara+n);
vector<long long> dist;
dist.push_back(ara[0]);
for(i=1;i<n;i++)
{
if(ara[i]!=ara[i-1])
dist.push_back(ara[i]);
}
x=dist.size();
mv=-1;
for(i=0;i<x;i++)
{
if(i==0)
{
if(dist[i]>1)
{
mv=0;
break;
}
}
else if(dist[i]-dist[i-1]>1)
{
mv=i;
break;
}
}
if(mv==-1)
{
if(x%2==0)
cout<<"Bob\n";
else
cout<<"Alice\n";
}
else if(x%2==1)
{
if(mv%2==0)
cout<<"Alice\n";
else
cout<<"Bob\n";
}
else if(mv%2==1)
cout<<"Bob\n";
else
cout<<"Alice\n";
// if(mv%2==0)
// cout<<"Bob\n";
// else
// cout<<"Alice\n";
}
return 0;
}