#include "bits/stdc++.h" using namespace std; #define all(x) begin(x),end(x) template ostream& operator<<(ostream &os, const pair &p) { return os << '(' << p.first << ", " << p.second << ')'; } template::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { string sep; for (const T &x : v) os << sep << x, sep = " "; return os; } #define debug(a) cerr << "(" << #a << ": " << a << ")\n"; typedef long long ll; typedef vector vi; typedef vector vvi; typedef pair pi; const int mxN = 1e5+1, oo = 1e9; /* starting, I can't reach a thing of the other colour in time loss. otherwise assume you can reach the other colour. if my thing is 1 big: Have to choose a side and recursively play it. If again it is 1 big. If I win on parity, I won If I lose on parity, other player can always play back, so this is just parity Otherwise, my run of cells is >1, can waste moves mod 2. If I can reach the other side with my parity I won. If can't reach other side or parities both bad, other player can force me back, so I lose */ bool solve(string s, int k, int t, bool first=1) { if(t==0) return false; int n = s.size(); if( (k==0 or s[k]!=s[k-1]) and (k==n-1 or s[k]==s[k+1])) { if(!first) { if(t%2==1) return true; return false; } bool won=0; if(k) won|=!solve(s,k-1,t-1,0); if(k!=n-1) won|=!solve(s,k+1,t-1,0); } // can walk multiple int i=k, j =k; while(i>0 and s[i-1]==s[k]) i--; while(j> n >> k >> t; string s; cin >> s; --k; auto res = solve(s,k,t); bool awon = res ^ (s[k]=='B'); cout << (awon?"Alice\n":"Bob\n"); }