Cod sursa(job #1043193)

Utilizator deneoAdrian Craciun deneo Data 28 noiembrie 2013 09:18:08
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 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 & 1))a & (-a)) a /= a & (-a);
        if (s.find(a) != s.end()) ++rez;
    }

    fout << rez;
    return 0;
}