Mai intai trebuie sa te autentifici.

Cod sursa(job #1036984)

Utilizator test9cosmin Macovei test9 Data 19 noiembrie 2013 20:02:00
Problema Dtcsu Scor 20
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include <iostream>
#include <fstream>
#include <tr1/unordered_set>
using namespace std;

tr1::unordered_set <long long> G;

int main()
{
    ifstream in("dtcsu.in");
    ofstream out("dtcsu.out");
    int q,nr=0;
    long long x;
    int n=276997;
    while(n--)
    {
        in>>x;
        if(x%2)
           G.insert(x);
    }
    in>>q;
    while(q--)
    {
        in>>x;
        if(x%2==0)
            x=x/(x&(-x));
        if(G.count(x))
            nr++;
    }
    out<<nr;
    return 0;
}