Cod sursa(job #2002225)

Utilizator pepsiM4A1Ozturk Arif pepsiM4A1 Data 19 iulie 2017 00:54:52
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.81 kb
#include <cstdio>
#include <unordered_set>
#define LL long long
using namespace std;
unordered_set<LL>ap;
const int DIM=50000;
int poz=DIM-1;
char buff[DIM];
void citeste(LL &nr)
{
    nr=0;
    while(!('0'<=buff[poz]&&buff[poz]<='9'))
    {
        if(++poz==DIM) fread(buff,1,DIM,stdin),poz=0;
    }
    while('0'<=buff[poz]&&buff[poz]<='9')
    {
        nr=nr*10 + buff[poz]-'0';
        if(++poz==DIM) fread(buff,1,DIM,stdin),poz=0;
    }
}
int main()
{
    freopen ("dtcsu.in","r",stdin);
    freopen ("dtcsu.out","w",stdout);
    LL val;
    for(int i=1;i<=276997;i++)
    {
        citeste(val);
        ap.insert(val);
    }
    LL q;
    citeste(q);
    int ct=0;
    for(;q>0;--q)
    {
        citeste(val);
        if(ap.find(val)!=ap.end()) ++ct;
    }
    printf("%d\n",ct);
}