Cod sursa(job #2026814)

Utilizator CodrinsahCotarlan Codrin Codrinsah Data 25 septembrie 2017 08:59:46
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.55 kb
#include <fstream>
#include <bitset>
#define lg 276997
using namespace std;
ifstream fi ("dtcsu.in");
ofstream fo ("dtcsu.out");
bitset<200004> hsh[6];
int i,x,q,h,sol;
int main()
{
    for (i=1;i<=lg;i++)
    {
      fi>>x;
      for (h=0;h<=5;h++)
        hsh[h][x%(100000+(35*h*h+74*h+108)%100001)]=1;
    }
    fi>>q;
    for (i=1;i<=q;i++)
    {
      fi>>x;
      bool ok=true;
      for (h=0;h<=5;h++)
        if (hsh[h][x%(100000+(35*h*h+74*h+108)%100001)]) ok=false;
      if (ok) sol++;
    }
    fo<<sol;
    return 0;
}