fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int maxn=2e5+5;
  4. void solve() {
  5. int N, K; cin >> N >> K;
  6. string S; cin >> S;
  7. int tot = 0;
  8. for(auto a:S) tot += (a-'0');
  9. if (tot <= K) {
  10. cout << "Alice" << endl; return;
  11. }
  12.  
  13. if (K*2-1 >= N) {
  14. cout << "Alice" << endl; return;
  15. }
  16. cout << "Bob" << endl;
  17.  
  18.  
  19. }
  20. signed main(){
  21. ios_base::sync_with_stdio(false);
  22. cin.tie(NULL);cout.tie(NULL);
  23.  
  24. int ntest;
  25. ntest=1;
  26. cin>>ntest;
  27.  
  28. for(int i=1;i<=ntest;i++) solve();
  29.  
  30. return 0;
  31. }
Success #stdin #stdout 0.01s 5288KB
stdin
6
5 2
11011
7 4
1011011
6 1
010000
4 1
1111
8 3
10110110
6 4
111111
stdout
Bob
Alice
Alice
Bob
Bob
Alice