Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // TLE code
- #include <bits/stdc++.h>
- #include <ext/pb_ds/assoc_container.hpp>
- #include <ext/pb_ds/detail/standard_policies.hpp>
- using namespace std;
- using namespace __gnu_pbds;
- template<typename T>
- using indexed_set [[maybe_unused]] = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
- #define ll long long
- #define pb push_back
- #define SZ(v) ((int)((v).size()))
- #define UNIQUE(v) sort(all(v));v.erase(unique(all(v)),v.end());
- const int N = 1e5+9;
- int a[N], b[N];
- void run () {
- int n, q;
- cin >> n >> q;
- for (int i = 0; i < n; ++i)
- cin >> a[i];
- for (int i = 0; i < q; ++i)
- cin >> b[i];
- for (int i = 0; i < q; ++i) {
- bool found = false;
- for (int j = 0; j < n; ++j) {
- if (b[i] == a[j]) {
- cout << "yes " << j + 1 << '\n';
- found = true;
- break;
- }
- }
- if(not found)
- cout << "no\n";
- }
- }
- int main () {
- ios_base::sync_with_stdio(false);
- cin.tie(nullptr);
- cout.tie(nullptr);
- // freopen("/home/hamoudi/clion/hello.in", "rt", stdin);
- int tt;
- tt = 1;
- // cin >> tt;
- while (tt--)
- run();
- }
- /*
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement