Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- int n, x;
- string s;
- cin>>n>>x>>s;
- int rem = 0;
- int possible = 1;
- for(int i=0; i<n; i++)
- {
- if(s[i] == '0')
- {
- if(rem == 0)
- {
- possible = 0;
- break;
- }
- rem--;
- }
- else
- rem = x;
- }
- if(possible) cout<<"YES\n";
- else cout<<"NO\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment