Cod sursa(job #2206969)

Utilizator Alex_BubBuburuzan Alexandru Alex_Bub Data 24 mai 2018 17:18:55
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.66 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("dtcsu.in");
ofstream fout("dtcsu.out");

const int NMAX = 276997;

unordered_set<int> v;

long long read() {
    string s;

    getline(fin, s);

    long long x = 0;

    for(string :: iterator it = s.begin(); it < s.end(); it++)
            x = x * 10 + (*it - '0');

    return 0;
}

int main()
{
    int nr = 0;

    for(int i = 0; i < NMAX; i++)
        v.insert(read());

    long long k = read();

    while(k--) {
        long long x = read();

        if(v.find(x) != v.end()) nr++;
    }

    fout << nr;

    fin.close();
    fout.close();

    return 0;
}