Cod sursa(job #3278157)

Utilizator jumaracosminJumara Cosmin-Mihai jumaracosmin Data 18 februarie 2025 18:26:05
Problema Dtcsu Scor 100
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.78 kb
#include <bits/stdc++.h>

std::ifstream fin("dtcsu.in");
std::ofstream fout("dtcsu.out");

const int rows = 276997;
const int mod = 8887;

int queries;
int64_t x;
std::vector<int64_t> hash[mod];

int main() 
{
    std::ios_base::sync_with_stdio(false);
    fin.tie(nullptr);

    for(int i = 1; i <= rows; ++i)
    {
        fin >> x;     
        hash[x % mod].emplace_back(x);
    }

    fin >> queries;

    int count = 0;

    for(int k = 1; k <= queries; ++k)
    {
        fin >> x;
        
        if(x >= 1)
        {
            for(auto value : hash[x % mod])
                if(value == x)
                {
                    count++;
                    break;
                }
        }
    }
    
    fout << count;

    return 0;
}