Pagini recente » Cod sursa (job #184107) | Cod sursa (job #800177) | Clasament oni_10_1 | Istoria paginii runda/oni_10_4 | Cod sursa (job #1263421)
#include <iostream>
#include <cstdio>
#include <vector>
#include<unordered_map>
using namespace std;
#define V 276997
#define mod 10000
#define maxBuf 10000
long Q,i;
vector<long long> H[mod];
unordered_map<long long> HH;
char Buff[maxBuf];
long pos,Ans;
long long x;
inline bool isDigit(char c){
return c >= '0' && c <= '9';
}
long long getLong(){
while(!isDigit(Buff[pos])){
pos++;
if(pos == maxBuf){
pos = 0;
fread(Buff,1,maxBuf,stdin);
}
}
long long Ans=0;
while(isDigit(Buff[pos])){
Ans = Ans*1LL*10 + Buff[pos++] - '0';
if(pos == maxBuf){
pos = 0;
fread(Buff,1,maxBuf,stdin);
}
}
return Ans;
}
bool isGood(long sour,long long x){
for(long i=0;i<H[sour].size();i++)
if(H[sour][i] == x) return true;
return false;
}
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
fread(Buff,1,maxBuf,stdin);
for(i=1;i<=V;i++){
x = getLong();
long dest = (1LL*x)%mod;
if(x&1) //H[dest].push_back(x);
HH.insert(x);
}
Q = getLong();
for(;Q;Q--){
x = getLong();
if((x&1)==0) x >>= 1;
long dest = (1LL*x) % mod;
//if(isGood(dest,x)) Ans++;
if(HH.find(x)) Ans++;
}
printf("%ld",Ans);
return 0;
}