Cod sursa(job #2306370)

Utilizator mihai50000Mihai-Cristian Popescu mihai50000 Data 22 decembrie 2018 11:02:02
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_map <long long, bitset <1> > H;

long long x;
int q, nr;

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