Cod sursa(job #1043191)

Utilizator deneoAdrian Craciun deneo Data 28 noiembrie 2013 09:17:08
Problema Dtcsu Scor 80
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.54 kb
#include <fstream>
#include <unordered_set>
using namespace std;

unordered_set <long long> s;

const int dim = 276997;

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

int main() {
    for (int i = 1; i <= dim; ++i) {
        long long a; fin >> a;
        if (a % 2 != 0)
            s.insert(a);
    }

    int q, rez = 0; fin >> q;

    for (int i = 1; i <= q; ++i) {
        long long a; fin >> a;
        if (a & (-a)) a /= a & (-a);
        if (s.find(a) != s.end()) ++rez;
    }

    fout << rez;
    return 0;
}