Advertisement
Asif_Anwar

Timus-1196. History Exam

Apr 9th, 2021
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.92 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. #define pb push_back
  5. #define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  6. #define F first
  7. #define S second
  8. typedef long long ll;
  9. typedef vector< int > vi;
  10. typedef vector< ll > V;
  11. typedef map<int, int > mp;
  12. #define debug cout << -1 << endl;
  13. #define REP(i, a, b) for(int i=a; i<b; i++)
  14. #define pop pop_back
  15. const ll MOD = 1000000007;
  16. const int maxN = 2001;
  17.  
  18. int dx[] = {-1, 0, 1, -1, 1, -1, 0, 1};
  19. int dy[] = {-1, -1, -1, 0, 0, 1, 1, 1};
  20.  
  21. void solve()
  22. {
  23.     int n, nn;
  24.     cin >> n;
  25.     mp m;
  26.     while(n--) {
  27.         int x;
  28.         cin >> x;
  29.         m[x]++;
  30.     }
  31.     cin >> nn;
  32.     int cnt = 0;
  33.     while(nn--) {
  34.         int x;
  35.         cin >> x;
  36.         if(m[x]) cnt++;
  37.     }
  38.     cout << cnt << endl;
  39.     return;
  40. }
  41.  
  42. int main()
  43. {
  44.     FastIO;
  45.     //freopen("billboard.in","r",stdin);
  46.     //freopen("billboard.out","w",stdout);
  47.     int t;
  48.     t = 1;
  49.     //cin >> t;
  50.     while(t--){
  51.         solve();
  52.     }
  53.     return 0;
  54. }
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement