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

Автор zetaz, 11 лет назад, По-английски

The Problem is :

Given N (1 <= N <= 10^6) numbers and K (1 <= K <= 23), each number can go up to 2^K-1. Now we can select some from the numbers to make a non empty set and OR all the number on the set, the problem ask the number of ways we can choose a set so the OR value will equal 2^K-1.

All i could think is O(N*(2^K)) Dynamic Programming which is too slow to solve this problem.

I'm sorry for my bad english. Does anyone have a better solution ?

Thanks

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