Advertisement
Mirbek

C - Route Map (Atcoder)

Jan 28th, 2022
990
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. const int N = 1e5 + 6;
  6.  
  7. int n, m;
  8. string a[N], b[N];
  9.  
  10. int main(){
  11.     cin >> n >> m;
  12.  
  13.     for (int i = 1; i <= n; i++) {
  14.         cin >> a[i];
  15.     }
  16.  
  17.     map <string, int> mp;
  18.     for (int i = 1; i <= m; i++) {
  19.         cin >> b[i];
  20.         mp[b[i]] = 1;
  21.     }
  22.  
  23.     for (int i = 1; i <= n; i++) {
  24.         if (mp[a[i]] == 1) {
  25.             cout << "Yes" << endl;
  26.         } else {
  27.             cout << "No" << endl;
  28.         }
  29.     }
  30. }
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement