From eff81b6c7085a7133075b70c14f9752ed7c8d064 Mon Sep 17 00:00:00 2001 From: Nitin Singh Kanyal <77480195+Legit-Doodle@users.noreply.github.com> Date: Sat, 8 Oct 2022 15:18:11 +0530 Subject: [PATCH] C problem CF global round --- main.cpp | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 main.cpp diff --git a/main.cpp b/main.cpp new file mode 100644 index 0000000..1cc692b --- /dev/null +++ b/main.cpp @@ -0,0 +1,105 @@ +/** + * author: theHoodeyGuy +**/ + +#include +using namespace std; +typedef long long ll; + +#define endl '\n' +#define nl '\n' + +int dp[101][101][2]; + +int help(int e,int o,int s){ + + // cout << e <<" "<= 2){ + ans1 = help(e-2,o,s); + } + ans1 = ans1 and help(e-1,o-1,s); + + //take odd + int ans2=1; + if(o >= 2){ + ans2 = help(e,o-2,1); + } + + ans2 = ans2 and help(e-1,o-1,1); + ans = ans1 or ans2; + } + + else{ + //take even + int ans1=1; + if(e >=2){ + ans1 = help(e-2,o,s); + } + ans1 = ans1 and help(e-1,o-1,s); + + //take odd + int ans2=1; + if(o >=2){ + ans2 = help(e,o-2,0); + } + ans2 = ans2 and help(e-1,o-1,0); + ans = ans1 or ans2; + } + return dp[e][o][s] = ans; +} + +void solve(){ + + int n; + cin >> n; + + vector a(n); + + int even = 0,odd = 0; + + for(int i=0;i> a[i]; + if(a[i]&1) odd++; + else even++; + } + + memset(dp,-1,sizeof(dp)); + + cout << (help(even,odd,0) ? "Alice" : "Bob" )<< nl; +} + +signed main() +{ + ios_base::sync_with_stdio(false);cin.tie(NULL); + + // #ifndef ONLINE_JUDGE + // freopen("input.txt", "r", stdin); + // freopen("output.txt", "w", stdout); + // #endif + + int t ; + cin>>t; + while(t--) + { + solve(); + } + +// cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<