Cod sursa(job #2265541)

Utilizator adimiclaus15Miclaus Adrian Stefan adimiclaus15 Data 21 octombrie 2018 13:48:06
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.79 kb
#include <bits/stdc++.h>

using namespace std;

#define dim 10001
char buff[dim];
int pos = 0;
long long x;
unordered_map <long long ,bool> mp;
void read (long long &nr) {
	nr = 0;
	while (buff[pos] < '0' || buff[pos] > '9')
		if (++pos == dim)
			fread(buff, 1, dim, stdin), pos = 0;
	while (buff[pos] >= '0' && buff[pos] <= '9') {
		nr = 10 * nr + buff[pos] - '0';
		if (++pos == dim)
			fread(buff, 1, dim, stdin), pos = 0;
	}
}
int main()
{
    freopen("dtcsu.in", "r", stdin);
	freopen("dtcsu.out", "w", stdout);
	int i,nrc=0;
	long long q;
	for(i=1;i<=276997;i++)
    {
        read(x);
        mp[x]=1;
    }
    read(q);
    while(q--)
    {
        read(x);
        if(mp[x]==1)
        {
            nrc++;
        }
    }
    cout<<nrc;
    return 0;
}