Cod sursa(job #1035601)

Utilizator mvcl3Marian Iacob mvcl3 Data 18 noiembrie 2013 18:08:26
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.6 kb
#include <fstream>
#include <algorithm>
#define in "dtcsu.in"
#define out "dtcsu.out"
#define Max_Size 13000
#define LL long long

std :: ifstream f(in);
std :: ofstream g(out);

LL V[Max_Size];
int Q;
LL x;

inline void Read_Data()
{
    for(int i = 1; i <= 12904; ++i) f >> V[i];

    f >> Q;
}

inline void Solve()
{
    int sol = 0;

    while(Q--)
    {
        f >> x;

        int pos = std :: lower_bound(V + 1, V + 12904 + 1, x) - V;
        if(pos >= 1 && pos <= 12904 && V[pos] == x) ++sol;
    }

    g << sol << '\n';
}

int main()
{
    Read_Data();
    std :: sort(V + 1, V + 12904 + 1);
    Solve();
}