Advertisement
Hamoudi30

Untitled

Jul 15th, 2021
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.21 KB | None | 0 0
  1. // TLE code
  2. #include <bits/stdc++.h>
  3. #include <ext/pb_ds/assoc_container.hpp>
  4. #include <ext/pb_ds/detail/standard_policies.hpp>
  5. using namespace std;
  6. using namespace __gnu_pbds;
  7. template<typename T>
  8. using indexed_set [[maybe_unused]] = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
  9. #define ll long long
  10. #define pb push_back
  11. #define SZ(v) ((int)((v).size()))
  12. #define UNIQUE(v) sort(all(v));v.erase(unique(all(v)),v.end());
  13. const int N = 1e5+9;
  14. int a[N], b[N];
  15. void run () {
  16.     int n, q;
  17.     cin >> n >> q;
  18.     for (int i = 0; i < n; ++i)
  19.         cin >> a[i];
  20.     for (int i = 0; i < q; ++i)
  21.         cin >> b[i];
  22.     for (int i = 0; i < q; ++i) {
  23.         bool found = false;
  24.         for (int j = 0; j < n; ++j) {
  25.             if (b[i] == a[j]) {
  26.                 cout << "yes " << j + 1 << '\n';
  27.                 found = true;
  28.                 break;
  29.             }
  30.         }
  31.         if(not found)
  32.             cout << "no\n";
  33.     }
  34. }
  35. int main () {
  36.     ios_base::sync_with_stdio(false);
  37.     cin.tie(nullptr);
  38.     cout.tie(nullptr);
  39. //    freopen("/home/hamoudi/clion/hello.in", "rt", stdin);
  40.     int tt;
  41.     tt = 1;
  42. //    cin >> tt;
  43.     while (tt--)
  44.         run();
  45. }
  46. /*
  47.  
  48.  */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement