Machine Learning
Time limit2sMemory limit512 MB
Count length-n arrays with values from 0 to k where each value is a submask of every later value, and the given index pairs must differ, modulo 1e9+7.
- Level
Hard8 of 10
- Topics
- Bit manipulation, Combinatorics, Dynamic programming
- Solved
- No attempts yet
Problem
An artificial intelligence lab developed a new machine learning method. Training uses iterations. In each iteration, the training program runs on one training set.
Training sets with complexity from 0 to are prepared. A training plan is an array , where is the complexity of the set used in iteration . For every from 1 to , it must hold that .
The effectiveness of a plan depends on the binary representations of the complexities. A plan is effective if, for any two indices and with , it holds that , where is the bitwise AND. For example, .
Using sets of the same complexity over and over does not make progress. So there are requirements. Each requirement gives two numbers and and means .
Count the effective plans that satisfy all requirements. Output the count modulo .
Input
The first line contains three integers , , and (, , ), the number of iterations, the number of requirements, and the maximum complexity.
Each of the next lines contains two integers and (). All requirements are distinct.
Output
Print one integer, the number of effective plans that satisfy all requirements, modulo .