結果

問題 No.1210 XOR Grid
ユーザー yudedakoyudedako
提出日時 2020-09-06 21:31:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 225 ms / 2,000 ms
コード長 1,134 bytes
コンパイル時間 1,898 ms
コンパイル使用メモリ 109,032 KB
実行使用メモリ 6,436 KB
最終ジャッジ日時 2023-08-19 14:20:52
合計ジャッジ時間 9,952 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,504 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,512 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,384 KB
testcase_07 AC 1 ms
4,384 KB
testcase_08 AC 1 ms
4,388 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,384 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,384 KB
testcase_15 AC 1 ms
4,384 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,384 KB
testcase_19 AC 2 ms
4,508 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 2 ms
4,384 KB
testcase_22 AC 1 ms
4,388 KB
testcase_23 AC 1 ms
4,384 KB
testcase_24 AC 2 ms
4,388 KB
testcase_25 AC 111 ms
4,732 KB
testcase_26 AC 112 ms
4,732 KB
testcase_27 AC 111 ms
4,876 KB
testcase_28 AC 114 ms
4,876 KB
testcase_29 AC 114 ms
4,692 KB
testcase_30 AC 89 ms
4,404 KB
testcase_31 AC 113 ms
4,660 KB
testcase_32 AC 113 ms
4,536 KB
testcase_33 AC 2 ms
4,384 KB
testcase_34 AC 1 ms
4,384 KB
testcase_35 AC 1 ms
4,380 KB
testcase_36 AC 27 ms
4,720 KB
testcase_37 AC 27 ms
4,688 KB
testcase_38 AC 26 ms
4,716 KB
testcase_39 AC 25 ms
4,836 KB
testcase_40 AC 50 ms
6,184 KB
testcase_41 AC 51 ms
6,172 KB
testcase_42 AC 225 ms
6,112 KB
testcase_43 AC 189 ms
6,168 KB
testcase_44 AC 221 ms
6,112 KB
testcase_45 AC 225 ms
6,160 KB
testcase_46 AC 219 ms
6,316 KB
testcase_47 AC 56 ms
6,124 KB
testcase_48 AC 57 ms
6,324 KB
testcase_49 AC 1 ms
4,384 KB
testcase_50 AC 108 ms
6,164 KB
testcase_51 AC 223 ms
6,436 KB
testcase_52 AC 186 ms
5,916 KB
testcase_53 AC 222 ms
6,240 KB
testcase_54 AC 55 ms
6,124 KB
testcase_55 AC 137 ms
6,116 KB
testcase_56 AC 115 ms
4,724 KB
testcase_57 AC 115 ms
5,360 KB
testcase_58 AC 2 ms
4,380 KB
testcase_59 AC 1 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cmath>
#include <vector>
#include <iostream>
#include <algorithm>
#include <set>
#include <iomanip>
#include <numeric>
#include <queue>
#include <string>
#include <map>
#include <fstream>
#include <cassert>
#include <stack>

constexpr long long int MOD = 1000000007;
long long int power(long long int base, long long int exp) {
	long long int result{ 1 };
	while (exp > 0) {
		if (exp & 1) {
			result = (result * base) % MOD;
			--exp;
		}
		else {
			base = (base * base) % MOD;
			exp >>= 1;
		}
	}
	return result;
}
int main() {
	int n, m, x; std::cin >> n >> m >> x;
	std::vector<long long int> row(n), column(m);
	for (auto& r : row) std::cin >> r;
	for (auto& c : column) std::cin >> c;
	const auto row_xor = std::accumulate(row.begin(), row.end(), 0LL, [](const long long int acc, const long long int r) {return acc ^ r; });
	const auto column_xor = std::accumulate(column.begin(), column.end(), 0LL, [](const long long int acc, const long long int l) {return acc ^ l; });
	if (row_xor != column_xor) {
		std::cout << 0 << '\n';
		return 0;
	}
	std::cout << power((1LL << x) % MOD, (n - 1LL) * (m - 1LL)) << '\n';
}
0