結果

問題 No.1142 XOR と XOR
ユーザー ryoissyryoissy
提出日時 2020-07-31 21:55:33
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 743 ms / 2,000 ms
コード長 851 bytes
コンパイル時間 1,698 ms
コンパイル使用メモリ 163,760 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:15:39
合計ジャッジ時間 14,420 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,820 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 AC 737 ms
6,944 KB
testcase_04 AC 582 ms
6,944 KB
testcase_05 AC 479 ms
6,944 KB
testcase_06 AC 613 ms
6,940 KB
testcase_07 AC 731 ms
6,940 KB
testcase_08 AC 743 ms
6,940 KB
testcase_09 AC 731 ms
6,944 KB
testcase_10 AC 740 ms
6,940 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 396 ms
6,940 KB
testcase_15 AC 389 ms
6,940 KB
testcase_16 AC 34 ms
6,944 KB
testcase_17 AC 551 ms
6,944 KB
testcase_18 AC 125 ms
6,944 KB
testcase_19 AC 612 ms
6,940 KB
testcase_20 AC 393 ms
6,944 KB
testcase_21 AC 245 ms
6,944 KB
testcase_22 AC 136 ms
6,940 KB
testcase_23 AC 568 ms
6,940 KB
testcase_24 AC 641 ms
6,940 KB
testcase_25 AC 368 ms
6,944 KB
testcase_26 AC 598 ms
6,944 KB
testcase_27 AC 484 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n,m,k;
int a[200005],b[200005];
int xa[200005];
int xb[200005];
ll cnt[2][2][1024];

int main(void){
	scanf("%d%d%d",&n,&m,&k);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
		xa[i+1]=xa[i]^a[i];
	}
	cnt[0][0][0]=1;
	for(int i=0;i<n;i++){
		for(int j=0;j<1024;j++){
			cnt[0][1][j^xa[i+1]]+=cnt[0][0][j];
			cnt[0][1][j^xa[i+1]]%=MOD;
		}
		cnt[0][0][xa[i+1]]++;
	}
	for(int i=0;i<m;i++){
		scanf("%d",&b[i]);
		xb[i+1]=xb[i]^b[i];
	}
	cnt[1][0][0]=1;
	for(int i=0;i<m;i++){
		for(int j=0;j<1024;j++){
			cnt[1][1][j^xb[i+1]]+=cnt[1][0][j];
			cnt[1][1][j^xb[i+1]]%=MOD;
		}
		cnt[1][0][xb[i+1]]++;
	}
	ll ans=0;
	for(int i=0;i<1024;i++){
		ans+=cnt[0][1][i]*cnt[1][1][k^i]%MOD;
		ans%=MOD;
	}
	printf("%lld\n",ans);
	return 0;
}
0