Cod sursa(job #1048680)

Utilizator misinozzz zzz misino Data 6 decembrie 2013 11:24:12
Problema Dtcsu Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.93 kb
#include<fstream>
#include<cstdio>
#include<bitset>
#include<unordered_set>
using namespace std;
int sol;
long long x,q;
unordered_set <long long> s;
const int D=200000;
char buf[D];
int poz=D+3;
inline long long ianr()
{
    unsigned long long nr=0;
    while((buf[poz]<'0'||buf[poz]>'9')&&buf[poz]!='-')
    if(++poz>=D)
    fread(buf,D,1,stdin),poz=0;
    while('0'<=buf[poz]&&buf[poz]<='9')
    {
        nr=nr*10+buf[poz]-'0';
        if(++poz>=D)
        fread(buf,D,1,stdin),poz=0;
    }
    return nr;
}
int main()
{
    freopen("dtcsu.in","r",stdin);
    freopen("dtcsu.out","w",stdout);
    long long x;
    for(int i=1;i<=276997;++i)
    {
       scanf("%lld",&x);
       x/=x&(-x);
       s.insert(x);
    }
    for(scanf("%lld",&q);q;--q)
    {
        scanf("%lld",&x);
        if(x==0)
        continue;
        x/=x&(-x);
        sol+=s.count(x);
    }
    printf("%d\n",sol);
    return 0;
}