Sequence Transformation
Time limit10sMemory limit512 MB
Count length-n integer sequences with entries in [1, 2^k) whose prefix bitwise-OR values are strictly increasing, for n up to 1e18 and k up to 30000.
- Level
Hard8 of 10
- Topics
- Combinatorics, Bit manipulation, Math, Dynamic programming
- Solved
- No attempts yet
Problem
Applying operation to the sequence produces the sequence , where and is the bitwise OR operation.
Apply to every sequence of length whose entries are integers at least and less than . Write a program that counts the sequences whose result is increasing, that is, .
Input
The first line contains and , separated by a space. (, )
Output
Print the number of such sequences modulo on the first line.