Cod sursa(job #3177458)

Utilizator paull122Paul Ion paull122 Data 29 noiembrie 2023 10:50:12
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.64 kb
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
ifstream fin("dtcsu.in");
ofstream fout("dtcsu.out");
#define HASH_BASE 73
#define HASH_SIZE 1000007

int computehash(int x)
{
    int strhash=0;
    while(x)
    {
        strhash = (strhash * HASH_BASE + x%10)%HASH_SIZE;
        x/=10;
    }
    return strhash;
}

unordered_set<ll> S;

int main()
{
    for(int i=1;i<=276997;i++)
    {
        ll x;
        fin >> x;
        S.insert(x);
    }
    int q;
    fin >> q;
    int cnt=0;
    while(q--)
    {
        int x;
        fin >> x;
        cnt += S.count(x);
    }
    fout << cnt;
}