Cod sursa(job #1035100)

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

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

int Q;
LL A[50009];
char Buff[Max_Size + 4];

inline void Read_Data()
{
    for(int i = 1; i <= 276997; ++i)
        f.getline(Buff, Max_Size);
    f >> Q;
    for(int i = 1; i <= Q; ++i) f >> A[i];
    f.close();
}

inline void Solve()
{
    std :: ifstream f(in);

    LL x = 0;
    int sol = 0;
    for(int i = 1; i <= 276997; ++i)
    {
        char c = ' ';
        while(c != '\n')
        {
            f.get(c);
            if(c != ' ' && c != '\n')   x = x * 10 + c - '0';
            else
            {
                int pos = std :: lower_bound(A + 1, A + Q + 1, x) - A;
                if(pos >= 1 && pos <= Q && A[pos] == x) ++sol;
                x = 0;
            }
        }
    }
}

int main()
{
    Read_Data();
    std :: sort(A + 1, A + Q + 1);
    Solve();

    g.close();
    return 0;
}