結果

問題 No.1142 XOR と XOR
ユーザー leaf_1415leaf_1415
提出日時 2020-07-31 21:59:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 1,431 bytes
コンパイル時間 716 ms
コンパイル使用メモリ 80,432 KB
実行使用メモリ 8,164 KB
最終ジャッジ日時 2024-04-25 16:15:51
合計ジャッジ時間 2,186 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 4 ms
6,944 KB
testcase_02 AC 4 ms
7,520 KB
testcase_03 AC 36 ms
8,036 KB
testcase_04 AC 28 ms
7,780 KB
testcase_05 AC 22 ms
7,264 KB
testcase_06 AC 28 ms
7,520 KB
testcase_07 AC 27 ms
8,164 KB
testcase_08 AC 34 ms
8,040 KB
testcase_09 AC 34 ms
7,940 KB
testcase_10 AC 34 ms
8,032 KB
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 4 ms
6,944 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 19 ms
6,940 KB
testcase_15 AC 19 ms
6,944 KB
testcase_16 AC 5 ms
6,944 KB
testcase_17 AC 22 ms
7,780 KB
testcase_18 AC 8 ms
6,944 KB
testcase_19 AC 29 ms
7,524 KB
testcase_20 AC 20 ms
7,524 KB
testcase_21 AC 13 ms
6,944 KB
testcase_22 AC 9 ms
7,652 KB
testcase_23 AC 26 ms
7,312 KB
testcase_24 AC 30 ms
7,908 KB
testcase_25 AC 19 ms
6,940 KB
testcase_26 AC 27 ms
7,784 KB
testcase_27 AC 23 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <string>
#include <algorithm>
#include <utility>
#define llint long long
#define inf 1e18
#define rep(x, s, t) for(llint (x) = (s); (x) < (t); (x)++)
#define Rep(x, s, t) for(llint (x) = (s); (x) <= (t); (x)++)
#define chmin(x, y) (x) = min((x), (y))
#define chmax(x, y) (x) = max((x), (y))
#define mod 1000000007

using namespace std;
typedef pair<llint, llint> P;

llint n, m, k;
llint a[200005], b[200005];
llint A[1024], B[1024];

llint sum[200005], cnt[1024];
void calc(llint a[], llint A[], llint n)
{
	for(int i = 1; i <= n; i++) sum[i] = sum[i-1] ^ a[i];
	for(int i = 0; i < 1024; i++) cnt[i] = 0;
	for(int i = 0; i <= n; i++) cnt[sum[i]]++;
	for(int i = 0; i < 1024; i++){
		for(int j = 0; j < 1024; j++){
			A[i^j] += cnt[i]*cnt[j];
		}
	}
	A[0] -= n+1;
	for(int i = 0; i < 1024; i++) A[i] /= 2;
	for(int i = 0; i < 1024; i++) A[i] %= mod;
}

int main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	cin >> n >> m >> k;
	for(int i = 1; i <= n; i++) cin >> a[i];
	for(int i = 1; i <= m; i++) cin >> b[i];
	
	calc(a, A, n), calc(b, B, m);
	
	llint ans = 0;
	for(int i = 0; i < 1024; i++){
		ans += A[i] * B[i^k] % mod, ans %= mod;
	}
	cout << ans << endl;

	return 0;
}
0