Cod sursa(job #2305627)

Utilizator Vlad3108Tir Vlad Ioan Vlad3108 Data 20 decembrie 2018 17:59:32
Problema Dtcsu Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.95 kb
#include <cstdio>
#include <cctype>
#include <unordered_set>
#define BUFF_SIZE (1<<10)
char buff[BUFF_SIZE];
int poz=BUFF_SIZE;
char GetChar(){
    if(poz==BUFF_SIZE){
        fread(buff,1,BUFF_SIZE,stdin);
        poz=0;
    }
    return buff[poz++];
}
long long GetInt(){
    long long n=0;
    char c;
    do{
        c=GetChar();
    }while(!isdigit(c));
    do{
        n=n*10+c-'0';
        c=GetChar();
    }while(isdigit(c));
    return n;
}
#define MOD 10000019
int key(unsigned int n){
    return n % MOD;
}
std::unordered_set<long long> H;
int main(){
    freopen("dtcsu.in","r",stdin);
    freopen("dtcsu.out","w",stdout);
    for(int i=1;i<=276997;++i){
        long long x=GetInt();
        H.insert(x/(x&(-x)));
    }
    long long q=GetInt();
    int sol=0;
    while(q--){
        long long x=GetInt();
        if(x>0&&H.find(x/(x&(-x)))!=H.end())
            ++sol;
    }
    printf("%d\n",sol);
    return 0;
}