Cod sursa(job #3209294)

Utilizator CimpoesuFabianCimpoesu Fabian George CimpoesuFabian Data 2 martie 2024 11:24:10
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <bits/stdc++.h>
using namespace std;

ifstream fin("dtcsu.in");
ofstream fout("dtcsu.out");
unordered_map<long long, bool> M;

int main()
{
    int i, n, Q, cnt = 0;
    long long x;
    for (i = 1; i <= 276997; i++)
    {
        fin >> x;
        x /= (x & (-x)); /// while (x%2==0) x/=2;
        M[x] = true;
    }
    fin >> Q;
    while (Q--)
    {
        fin >> x;
        x /= (x & (-x));
        if (M[x] == true) cnt++;
    }
    fout << cnt << "\n";
    return 0;
}