Cod sursa(job #3209300)

Utilizator tomaionutIDorando tomaionut Data 2 martie 2024 11:27:19
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <bits/stdc++.h>

using namespace std;

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

vector <int> h[8200];

void Adauga(int x)
{
    int r = x % 8191;
    h[r].push_back(x);
}

int DoIEvenExist(int x)
{
    int r = x % 8191;
    for (auto w : h[r])
        if (w == x)
        return 1;
    return 0;
}

int main()
{
    int i, x, q, sol = 0;
    for (i = 1; i <= 276997; i++)
    {
        fin >> x;
        x /= (x & (-x));
        Adauga(x);
    }
    fin >> q;
    for (i = 1; i <= q; i++)
    {
        fin >> x;
        sol += DoIEvenExist();
    }
    fout << sol << "\n";

    return 0;
}