Cod sursa(job #1853961)
| Utilizator | Data | 22 ianuarie 2017 11:32:46 | |
|---|---|---|---|
| Problema | Dtcsu | Scor | 0 |
| Compilator | cpp | Status | done |
| Runda | antr5 | Marime | 0.79 kb |
#include <cstdio>
#include <vector>
#define MOD 40000
using namespace std;
std :: vector <long long> Hash[46001];
int m;
long long x;
inline void add_to_Hash(int x){
int L = x % MOD;
Hash[L].push_back(x);
}
inline bool check_Hash(int x){
int L = x % MOD;
vector<long long>:: iterator it;
for(it = Hash[L].begin(); it != Hash[L].end() ; ++it)
if(*it == x) return 1;
return 0;
}
int main()
{
freopen("dtcsu.in", "r", stdin);
freopen("dtcsu.out", "w", stdout);
for(int i = 1; i <= 276997 ; ++i){
scanf("%lld", &x);
add_to_Hash(x);
}
scanf("%d", &m);
int Sol = 0;
for(int i = 1; i <= m ; ++i){
scanf("%d", &x);
Sol = Sol + check_Hash(x);
}
printf("%d", Sol);
return 0;
}
