304687: CF894B. Ralph And His Magic Field
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Ralph And His Magic Field
题意翻译
一个n*m的方格网,要在每个方格里都填上一个整数并且使得每一行每一列填的数的乘积都为k,输出填数的方案的总数模1e9+7.保证k=1或者-1. 感谢@Fuko_Ibuki 提供的翻译题目描述
Ralph has a magic field which is divided into $ n×m $ blocks. That is to say, there are $ n $ rows and $ m $ columns on the field. Ralph can put an integer in each block. However, the magic field doesn't always work properly. It works only if the product of integers in each row and each column equals to $ k $ , where $ k $ is either 1 or -1. Now Ralph wants you to figure out the number of ways to put numbers in each block in such a way that the magic field works properly. Two ways are considered different if and only if there exists at least one block where the numbers in the first way and in the second way are different. You are asked to output the answer modulo $ 1000000007=10^{9}+7 $ . Note that there is no range of the numbers to put in the blocks, but we can prove that the answer is not infinity.输入输出格式
输入格式
The only line contains three integers $ n $ , $ m $ and $ k $ ( $ 1<=n,m<=10^{18} $ , $ k $ is either 1 or -1).
输出格式
Print a single number denoting the answer modulo $ 1000000007 $ .
输入输出样例
输入样例 #1
1 1 -1
输出样例 #1
1
输入样例 #2
1 3 1
输出样例 #2
1
输入样例 #3
3 3 -1
输出样例 #3
16