結果

問題 No.1210 XOR Grid
ユーザー ianCKianCK
提出日時 2020-09-11 19:51:52
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 367 ms
コンパイル使用メモリ 24,192 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-26 14:24:23
合計ジャッジ時間 6,248 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("%d%d%d", &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() {
	int n, m, x;
	scanf("%d%d%d", &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(Pow((1LL << x) % kMod, n - 1), m - 1));
}
0