Cod sursa(job #2367614)

Utilizator mateibanuBanu Matei Costin mateibanu Data 5 martie 2019 11:41:34
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.67 kb
#include <bits/stdc++.h>


using namespace std;



#define ll long long

ifstream in("dtcsu.in");
ofstream out("dtcsu.out");

set <ll>s;

ll x;
int n,total;



int main()

{

    /*freopen("dtcsu.in","r",stdin);

    freopen("dtcsu.out","w",stdout);*/

    for (int i=1;i<=276997;i++){

        //scanf("%lld",&x)
        in>>x;

        s.insert(x/(x&-x));

    }

    scanf("%d",&n);

    while (n){

        n--;

        //scanf("%lld",&x);
        in>>x;
        if (x==0) continue;

        if (s.find(x/(x&-x))!=s.end()){

            total++;

        }

    }

    //printf("%d",total);
    out<<total;
    return 0;

}