Cod sursa(job #1561626)

Utilizator SilviuIIon Silviu SilviuI Data 4 ianuarie 2016 12:37:32
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.7 kb
#include <stdio.h>
#include <bitset>
#define lmax 276997
#define mod1 3666013
#define mod2 2712343
#define mod3 1756891
#define mod4 2564131
#define mod5 3458913

using namespace std;
typedef long long int ll;

int n,nr;
ll x;
bitset <4000010> uhash;

int main()
{
	freopen("dtcsu.in","r",stdin);
	freopen("dtcsu.out","w",stdout);
	for (int i=1;i<=lmax;i++) {
		scanf("%lld",&x); 
		uhash[x%mod1]=1; uhash[x%mod2]=1; uhash[x%mod3]=1; 
		uhash[x%mod4]=1; uhash[x%mod5]=1;
	}
	scanf("%d",&n);
	for (int i=1;i<=n;i++) {
		scanf("%lld",&x);
		if (uhash[x%mod1]==1 && uhash[x%mod2]==1 && uhash[x%mod3]==1
		    && uhash[x%mod4]==1 && uhash[x%mod5]==1) nr++;
	}
	printf("%d",nr);
	return 0;
}