ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1196. History Exam

Here's Solution
Posted by Meirambek 4 Aug 2012 15:27
//Solution By Omyrzak Meirambek
#include <iostream>
#include <fstream>
#include <cstdio>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
#include <string>
#include <utility>
#include <cstdlib>
#include <algorithm>
#include <ctime>
#include <vector>
#include <map>
using namespace std;
#define fname ""
#define ull unsigned long long
#define ll long long
#define INF 1000*1000*1000
const int N = 20000;
map <int, int> q;
int n, x, res = 0, m;
int main ()
{
    #ifndef ONLINE_JUDGE
    freopen ("in","r",stdin);
    freopen ("out","w",stdout);
    #endif

    cin >> n;
    for (int i = 1; i <= n; i ++ ) {
        cin >> x;
        q[x] = 1;
    }
    cin >> m;

    for (int i = 1; i <= m; i ++ ) {
        cin >> x;
        res += q[x];
    }

    cout << res;

    return 0;
}