Iamtui1010

starf

Nov 10th, 2021
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.54 KB | None | 0 0
  1. //#include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<vector>
  4.  
  5. #define long long long
  6. #define nln '\n'
  7.  
  8. using namespace std;
  9.  
  10. // GLobal variables: t
  11.  
  12. int main()
  13. {
  14.     long t;
  15.     cin >> t;
  16.     for (long i = 0; i != t; ++i)
  17.     {
  18.         long n, s;
  19.         cin >> n >> s;
  20.         vector<bool> tic(n, 0);
  21.         for (long j = 0; j != n; ++j)
  22.         {
  23.             long x;
  24.             cin >> x;
  25.             if (x <= s)
  26.                 tic[j] = 1;
  27.         }
  28.         long got = 0;
  29.         for (long j = 0; j != n; ++j)
  30.         {
  31.             long x;
  32.             cin >> x;
  33.             if (tic[j])
  34.                 got += x;
  35.         }
  36.         cout << got << nln;
  37.     }
  38.     return 0;
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment