Cod sursa(job #1854357)

Utilizator giotoPopescu Ioan gioto Data 22 ianuarie 2017 17:02:05
Problema Dtcsu Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.73 kb
#include <cstdio>
#include <vector>
#define MOD 12289
using namespace std;

vector <long long> Hash[12290];
vector <long long> :: iterator it;
int m;
long long x;
int main()
{
    freopen("dtcsu.in", "r", stdin);
    freopen("dtcsu.out", "w", stdout);
    for(int i = 1; i <= 276997 ; ++i){
        scanf("%lld", &x);
        if(x % 2 == 1)
            Hash[x % MOD].push_back(x);
    }
    m = 3;
    scanf("%d", &m);
    int Sol = 0;
    for(int i = 1; i <= m ; ++i){
        scanf("%lld", &x);
        if(!x) continue ;
        x = x / (x & (-x));
        for(it = Hash[x % MOD].begin(); it != Hash[x % MOD].end() ; ++it)
            if(*it == x){++Sol; break;}

    }
    printf("%d", Sol);
    return 0;
}