CF238A.Not Wool Sequences
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
A sequence of non-negative integers _a_1, _a_2, ..., a__n of length n is called a wool sequence if and only if there exists two integers l and r (1 ≤ l ≤ r ≤ n) such that
. In other words each wool sequence contains a subsequence of consecutive elements with xor equal to 0.
The expression
means applying the operation of a bitwise xor to numbers x and y. The given operation exists in all modern programming languages, for example, in languages C++ and Java it is marked as "^", in Pascal — as "xor".
In this problem you are asked to compute the number of sequences made of n integers from 0 to 2_m_ - 1 that are not a wool sequence. You should print this number modulo 1000000009 (109 + 9).
一个长度为 n 的非负整数序列 a1,a2,…,an 被称为“羊毛序列”(wool sequence),当且仅当存在两个整数 l 和 r(满足 1≤l≤r≤n),使得
。
换言之,每个羊毛序列都包含一段连续子序列,其异或(xor)值等于 0。
表达式
表示对整数 x 和 y 执行按位异或运算。该运算在所有现代编程语言中均存在;例如,在 C++ 和 Java 中记作 ^,在 Pascal 中记作 xor。
本题要求你计算:由 n 个取自区间 [0,2m−1] 的整数组成、且不是羊毛序列的序列个数。请将结果对 1000000009(即 109+9)取模后输出。
输入格式
The only line of input contains two space-separated integers n and m (1 ≤ n, m ≤ 105).
输入仅包含一行,其中有两个用空格分隔的整数 n 和 m(1 ≤ n, m ≤ 105)。
输出格式
Print the required number of sequences modulo 1000000009 (109 + 9) on the only line of output.
在输出的唯一一行中,打印所需序列的数量对 1000000009(109+9)取模的结果。
输入输出样例
输入#1
3 2
输出#1
6
说明/提示
Sequences of length 3 made of integers 0, 1, 2 and 3 that are not a wool sequence are (1, 3, 1), (1, 2, 1), (2, 1, 2), (2, 3, 2), (3, 1, 3) and (3, 2, 3).
由整数 0、1、2 和 3 构成的长度为 3 且不是羊毛序列(wool sequence)的序列有:(1,3,1)、(1,2,1)、(2,1,2)、(2,3,2)、(3,1,3) 和 (3,2,3)。
输入解题思路,AI测评打分。不知道怎么写?