Cod sursa(job #2026812)

Utilizator CodrinsahCotarlan Codrin Codrinsah Data 25 septembrie 2017 08:54:49
Problema Dtcsu Scor 0
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.57 kb
#include <fstream>
#include <bitset>
#define lg 276997
using namespace std;
ifstream fi ("dtcsu.in");
ofstream fo ("dtcsu.out");
bitset<100000> hsh[3];
int i,x,q,h,sol;
int main()
{
    for (i=1;i<=lg;i++)
    {
      fi>>x;
      hsh[0][x%99073]=1;
      hsh[1][x%99607]=1;
      hsh[2][x%90601]=1;
    }
    fi>>q;
    for (i=1;i<=q;i++)
    {
      fi>>x;
      bool ok=true;
      if (hsh[0][x%99073]==0) ok=false;
      if (hsh[1][x%99607]==0) ok=false;
      if (hsh[2][x%90601]==0) ok=false;
      if (ok) sol++;
    }
    fo<<sol;
    return 0;
}