Блог пользователя tautology

Автор tautology, история, 6 лет назад, По-английски

Given array of n non-negative integers and a positive integer k. Is is possible to count all pairs with bitwise-OR equals to k?. Time complexity should be better than O(n^2). More formally , count no. of distinct pairs (ai,aj) such that ai|aj==k.[Note: pairs (ai,aj) and (aj,ai) are same.] If this is possible in T(n)<O(n^2),then how? Constraints: 1<=n<=1000000, 0<=ai<=10000.

  • Проголосовать: нравится
  • -29
  • Проголосовать: не нравится