Cod sursa(job #3209297)

Utilizator AbRobertAbabei Robert-Petronel AbRobert Data 2 martie 2024 11:24:52
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.57 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;
    ios_base::sync_with_stdio(0);
    fin.tie(0);
    fout.tie(0);
    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;
}