Cod sursa(job #2304851)

Utilizator PopeangaMihneaPopeanga Mihnea- Stefan PopeangaMihnea Data 18 decembrie 2018 18:33:42
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <bits/stdc++.h>

using namespace std;

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

int x, n;
unordered_set<int>H;

int main()
{
    for(int i=1; i<=276997; ++i)
    {
        fin>>x;
        H.insert(x);
    }
    /*for(int i=1; i<=10; ++i)
    {
        fin>>x;
        H.insert(x);
    }*/
    //for(unordered_set<int>::iterator it=H.begin(); it!=H.end(); ++it) fout<<*it<<" ";
    //fout<<"\n";
    int sol=0;
    fin>>n;
    //fout<<n<<"\n";
    for(int i=1; i<=n; ++i)
    {
        fin>>x;
        //fout<<x<<"\n";
        if(H.find(x)!=H.end()) ++sol;
    }
    fout<<sol<<"\n";
    return 0;
}