Pagini recente » Cod sursa (job #1139632) | Cod sursa (job #774576) | Cod sursa (job #1574171) | Cod sursa (job #2005855) | Cod sursa (job #1848628)
#include <stdio.h>
#include <vector>
using namespace std;
#define M 666013
vector<long long> h[M];
inline vector<long long>::iterator find_value(long long x)
{
int ord = x % M;
vector<long long>::iterator it;
for (it = h[ord].begin(); it != h[ord].end(); ++it)
if (*it == x)
return it;
return h[ord].end();
}
inline void add(long long x)
{
int ord = x % M;
h[ord].push_back(x);
}
int main()
{
long long i, y, n, k=0;
freopen("dtcsu.in", "r", stdin);
freopen("dtcsu.out", "w", stdout);
int x=276997;
for(i=1;i<=x;i++){
scanf("%d", &y);
add(y);
}
scanf("%d", &n);
while(n--)
{
scanf("%d", &y);
if (find_value(y) != h[y % M].end()) ++k;
}
printf("%d", k);
return 0;
}