IMohammedNasr

Day 1 / K

Aug 18th, 2022
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4.  
  5.  
  6. void solve(){
  7.     int n, k, q, zeros = 0; cin>>n>>k>>q;
  8.     vector<int> v(n), gaps(n+1);
  9.     for(auto&i:v) cin>>i, zeros += !i;
  10.     gaps[1] = zeros;
  11.     for(int i = 1; i<n; i++){
  12.         zeros -= !v[i-1];
  13.         gaps[i+1] = zeros;
  14.     }
  15.     while(q--){
  16.         int f; cin>>f;
  17.         cout<<(gaps[f] <= k ? "YES" : "NO")<<'\n';
  18.     }
  19. }
  20.  
  21. int main(){
  22.     ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); 
  23.     int TC = 1;
  24.     cin>>TC;
  25.     while(TC--){
  26.         solve();
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment