-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAccess_Control.cpp
More file actions
40 lines (38 loc) · 929 Bytes
/
Copy pathAccess_Control.cpp
File metadata and controls
40 lines (38 loc) · 929 Bytes
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
#define ll long long
#define f(end) for(int i=0;i<end;i++)
#define e '\n'
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t,x,n;
cin>>t;
while(t--)
{
cin>>n>>x;
string s;
int count=0,temp=0;
bool ans=true;
cin>>s;
f(n){
if(s[i]=='1'){
temp=x;
}else{
if(temp>0){
temp--;
}
else{
ans=false;
break;
}
}
}
if(ans) cout<<"YES"<<e;
else cout<<"NO"<<e;
}
return 0;
}
//we need to check if count is greater than 0 we keep reducing it according to question asked but if the swipes are 0 at some
// point and the the given string is not finished then we make answer as false and according to boolean answer variable we
// print yes or no