Cod sursa(job #2300372)

Utilizator sandupetrascoPetrasco Sandu sandupetrasco Data 11 decembrie 2018 11:15:00
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.54 kb
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define MOD 666013
#define z(x) (x & (-x))

using namespace std;
typedef long long ll;
typedef pair< ll , ll > PII;
 
int n, q, rs;
ll x;
unordered_map < ll, bool > M;
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
 
    ifstream cin("dtcsu.in");
    ofstream cout("dtcsu.out");

	for (int i = 1; i <= 276997; i++) {
		cin >> x;
		if (x & 1LL) M[x] = 1;
	}

	cin >> q;
	while (q--) {
		cin >> x;
		if (!x) continue;
		rs += M[x / z(x)];
	}

	cout << rs;
	return 0;
}