CF1605F.PalindORme
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
An integer array a of length n is said to be a PalindORme if ( a1 ∣ $a_{2} $ ∣ $ \ldots $ ∣ $ a_{i}) = (a_{{n - i + 1}} $ ∣ $ \ldots $ ∣ $ a_{{n - 1}} $ ∣ $ a_{n}) $ for all $ 1 \leq i \leq n$ , where ∣ denotes the bitwise OR operation.
An integer array a of length n is considered to be good if its elements can be rearranged to form a PalindORme. Formally, array a is good if there exists a permutation p1,p2,…pn (an array where each integer from 1 to n appears exactly once) for which ap1,ap2,…apn is a PalindORme.
Find the number of good arrays of length n , consisting only of integers in the range [0,2k−1] , and print it modulo some prime m .
Two arrays a1,a2,…,an and b1,b2,…,bn are considered to be different if there exists any i (1≤i≤n) such that ai=bi .
输入格式
The first and only line of the input contains three integers n , k and m ( 1≤n,k≤80 , 108<m<109 ). It is guaranteed that m is prime.
输出格式
Print a single integer — the number of good arrays modulo m .
输入输出样例
输入#1
1 1 998244353
输出#1
2
输入#2
3 2 999999733
输出#2
40
输入#3
7 3 796735397
输出#3
1871528
输入#4
2 46 606559127
输出#4
177013
说明/提示
In the first sample, both the possible arrays [0] and [1] are good.
In the second sample, some examples of good arrays are:
- [2,1,2] because it is already PalindORme.
- [1,1,0] because it can rearranged to [1,0,1] which is PalindORme
Note that [1,1,0] , [1,0,1] and [0,1,1] are all good arrays and are considered to be different according to the definition in the statement.
In the third sample, an example of a good array is [1,0,1,4,2,5,4] . It can be rearranged to an array b=[1,5,0,2,4,4,1] which is a PalindORme because:
- OR(1,1) = OR(7,7) = 1
- OR(1,2) = OR(6,7) = 5
- OR(1,3) = OR(5,7) = 5
- OR(1,4) = OR(4,7) = 7
- OR(1,5) = OR(3,7) = 7
- OR(1,6) = OR(2,7) = 7
- OR(1,7) = OR(1,7) = 7
Here OR(l,r) denotes bl ∣ $b_{l+1} $ ∣ $ \ldots $ ∣ $ b_{r}$