Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- void solve(){
- int n, k, q, zeros = 0; cin>>n>>k>>q;
- vector<int> v(n), gaps(n+1);
- for(auto&i:v) cin>>i, zeros += !i;
- gaps[1] = zeros;
- for(int i = 1; i<n; i++){
- zeros -= !v[i-1];
- gaps[i+1] = zeros;
- }
- while(q--){
- int f; cin>>f;
- cout<<(gaps[f] <= k ? "YES" : "NO")<<'\n';
- }
- }
- int main(){
- ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
- int TC = 1;
- cin>>TC;
- while(TC--){
- solve();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment