-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLightoj_1253.cpp
91 lines (89 loc) · 1.97 KB
/
Lightoj_1253.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include<bits/stdc++.h>
using namespace std;
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fileRead freopen("input.txt","r",stdin);
#define fileWrite freopen("output.txt","w",stdout);
#define lightoj_test_case_loop(test) for(int cs=1;cs<=test;cs++)
#define lightoj_output cout<<"Case "<<cs<<": "
#define pb push_back
#define mp make_pair
#define white 0
#define grey 1
#define black 2
#define ll long long
int fx[]={+1,-1,0,0};
int fy[]={0,0,+1,-1};
int turnOn(int x,int pos) {
return x | (1<<pos-1);
}
bool isOn(int N,int pos) {
return (bool)(N & (1<<pos-1));
}
///lcs using dp
/*
int lcs_dp[31][31]={0};
int longest_common_sub(int i,int j,string &a,string &b)
{
if(i==a.length()||j==b.length())
return 0;
if(lcs_dp[i][j]!=-1)
return lcs_dp[i][j];
int ans=0;
if(a[i]==b[j])
ans=1+longest_common_sub(i+1,j+1,a,b);
else
ans=max(longest_common_sub(i+1,j,a,b),longest_common_sub(i,j+1,a,b));
return lcs_dp[i][j]=ans;
}
*/
///BigMod
/*
ll BigMod(ll base,ll power,ll mod)
{
if(power==0)
return 1;
if(power%2==1)
return (base%mod)*(BigMod(base,power-1,mod)%mod)%mod;
else
{
ll res = (BigMod(base,power/2,mod)%mod);
return (res*res)%mod;
}
}
*/
int main()
{
int test_case;
cin>>test_case;
lightoj_test_case_loop(test_case)
{
int n;
cin>>n;
int ara[n];
int countOfOne=0;
int ans=0;
for(int i=0;i<n;i++)
{
cin>>ara[i];
ans^=ara[i];
if(ara[i]==1)
countOfOne++;
}
if(countOfOne==n)
{
if(countOfOne%2==1)
{
lightoj_output<<"Bob"<<endl;
}
else
lightoj_output<<"Alice"<<endl;
continue;
}
if(ans>0)
{
lightoj_output<<"Alice"<<endl;
}
else
lightoj_output<<"Bob"<<endl;
}
}