Codeforces Round 737 (Div. 2)
C
Moamen and XOR
Codeforces
1700
原题
← BD →
翻译中…

Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.

翻译中…

Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.

翻译中…

Here $\&$ denotes the bitwise AND operation, and $\oplus$ denotes the bitwise XOR operation.

翻译中…

Please calculate the number of winning for Moamen arrays $a$.

翻译中…

As the result may be very large, print the value modulo $1\,000\,000\,007$ ($10^9 + 7$).

翻译中…

Input

翻译中…

The first line contains a single integer $t$ ($1 \le t \le 5$)— the number of test cases.

翻译中…

Each test case consists of one line containing two integers $n$ and $k$ ($1 \le n\le 2\cdot 10^5$, $0 \le k \le 2\cdot 10^5$).

翻译中…

Output

翻译中…

For each test case, print a single value — the number of different arrays that Moamen wins with.

翻译中…

Print the result modulo $1\,000\,000\,007$ ($10^9 + 7$).

翻译中…

Note

翻译中…

In the first example, $n = 3$, $k = 1$. As a result, all the possible arrays are $[0,0,0]$, $[0,0,1]$, $[0,1,0]$, $[1,0,0]$, $[1,1,0]$, $[0,1,1]$, $[1,0,1]$, and $[1,1,1]$.

翻译中…

Moamen wins in only $5$ of them: $[0,0,0]$, $[1,1,0]$, $[0,1,1]$, $[1,0,1]$, and $[1,1,1]$.

翻译中…

样例

Input #1
3
3 1
2 1
4 0
Output #1
5
2
1
InputCopy OutputCopy
题目信息
题号
1557C
时间限制
2 s
内存限制
256 MB
标签
位运算
组合数学
动态规划
数学
矩阵

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。