Cod sursa(job #2206439)

Utilizator Stefan_RaduStefan Radu Stefan_Radu Data 22 mai 2018 18:24:28
Problema Dtcsu Scor 100
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.5 kb
#include <cstdio>
#include <unordered_set>

using namespace std;

int main () {

  freopen ("dtcsu.in", "r", stdin);
  freopen ("dtcsu.out", "w", stdout);

  unordered_set < long long > s;

  int k = 276997;

  long long x;
  while (k --) {
      
    scanf ("%lld", &x);
    if (x & 1) {
      s.insert (x);
    }
  }

  int q;
  scanf ("%d", &q);

  int cnt = 0;
  while (q --) {

    scanf ("%lld", &x);
    if (x and s.find (x / (x & -x)) != s.end ()) {
      ++ cnt;
    }
  }

  printf ("%d\n", cnt);
}