Cod sursa(job #2306372)

Utilizator mihai50000Mihai-Cristian Popescu mihai50000 Data 22 decembrie 2018 11:04:11
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.59 kb
#include <bits/stdc++.h>
#include <fstream>
#include <vector>
#include <bitset>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>
#include <stack>
#include <string.h>
#include <set>
 
using namespace std;
 
ifstream in("dtcsu.in");
ofstream out("dtcsu.out");

unordered_set <long long> H;

long long x;
int q, nr;

int main()
{
	for(int i = 1; i <= 276997; i++)
	{
		in >> x;
		
		H.insert(x / (x & -x));
	}
	
	in >> q;
	
	while(q--)
	{
		in >> x;
		
		if(x == 0)
			continue;
		
		if(H.find(x / (x & -1)) != H.end())
			nr++;
	}
	
	out << nr;
	return 0;
}