結果

問題 No.1210 XOR Grid
ユーザー ianCK
提出日時 2020-09-11 19:53:11
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 622 bytes
コンパイル時間 344 ms
コンパイル使用メモリ 23,936 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 14:28:29
合計ジャッジ時間 4,543 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 57
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |         scanf("%lld%lld%lld", &n, &m, &x);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:21:43: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |         for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
      |                                      ~~~~~^~~~~~~~~~~~~~~
main.cpp:22:43: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |         for (int i = 1; i <= m; i++) scanf("%lld", &b[i]);
      |                                      ~~~~~^~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

typedef long long int ll;
constexpr int kMod = int(1E9 + 7), kN = int(2E5 + 10);

ll Pow(ll a, ll b) {
	ll ans = 1;
	while (b) {
		if (b & 1) ans = ans * a % kMod;
		a = a * a % kMod;
		b >>= 1;
	}
	return ans;
}

ll a[kN], b[kN];

int main() {
	ll n, m, x;
	scanf("%lld%lld%lld", &n, &m, &x);
	for (int i = 1; i <= n; i++) scanf("%lld", &a[i]);
	for (int i = 1; i <= m; i++) scanf("%lld", &b[i]);
	for (int i = 2; i <= n; i++) b[1] ^= a[i];
	for (int i = 2; i <= m; i++) a[1] ^= b[i];
	if (a[1] != b[1]) printf("0\n");
	else printf("%lld\n", Pow((1LL << x) % kMod, (n - 1) * (m - 1) % (kMod - 1)));
}
0