結果

問題 No.1142 XOR と XOR
ユーザー sashimingsashiming
提出日時 2020-08-04 01:15:54
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,077 bytes
コンパイル時間 3,182 ms
コンパイル使用メモリ 209,104 KB
実行使用メモリ 6,792 KB
最終ジャッジ日時 2023-10-11 21:40:26
合計ジャッジ時間 12,941 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 270 ms
4,352 KB
testcase_01 AC 270 ms
4,368 KB
testcase_02 AC 261 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 315 ms
6,136 KB
testcase_05 AC 305 ms
6,024 KB
testcase_06 AC 318 ms
6,044 KB
testcase_07 WA -
testcase_08 AC 328 ms
6,584 KB
testcase_09 AC 327 ms
6,592 KB
testcase_10 AC 328 ms
6,732 KB
testcase_11 AC 261 ms
4,348 KB
testcase_12 AC 262 ms
4,348 KB
testcase_13 AC 263 ms
4,348 KB
testcase_14 AC 287 ms
5,176 KB
testcase_15 AC 286 ms
5,096 KB
testcase_16 AC 267 ms
4,372 KB
testcase_17 WA -
testcase_18 AC 274 ms
4,352 KB
testcase_19 AC 317 ms
6,460 KB
testcase_20 AC 299 ms
5,416 KB
testcase_21 AC 288 ms
4,676 KB
testcase_22 AC 279 ms
4,368 KB
testcase_23 AC 314 ms
6,116 KB
testcase_24 AC 319 ms
6,412 KB
testcase_25 AC 276 ms
5,108 KB
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

using lnt = long long;
using Real = long double;

#define ALL(obj) (obj).begin(),(obj).end()
#define RALL(obj) (obj).rbegin(),(obj).rend()
#define REP(i, n) for(lnt i=0;i<(n);++i)
#define RANGE(i, a, b) for(lnt i=(a);i<(b);++i)
#define RREP(i, n) for(lnt i=(n)-1;i>= 0;--i)

#define ln '\n'
#define pb push_back
#define eb emplace_back
#define pque priority_queue
#define umap unordered_map
#define uset unordered_set
#define dcout cout<<fixed<<setprecision(20)
#define summon_tourist cin.tie(0);ios::sync_with_stdio(false)

constexpr int dx[]={1,0,-1,0,1,1,-1,-1}, dy[]={0,-1,0,1,1,-1,1,-1};
constexpr Real eps = 1e-9; const Real pi = acosl(-1);
constexpr lnt BIG = INT_MAX/10, BBIG = LLONG_MAX/10;

template<class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template<class T> inline T LCM(T a,T b){T c=GCD(a,b);a/=c;return a*b;}
template<class T> inline T nCr(T a,T b){T i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
template<class T> inline T nHr(T a,T b){return nCr(a+b-1,b);}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}

using pint = pair<int, int>; using plnt = pair<lnt, lnt>;
using vint = vector<int>; using vlnt = vector<lnt>;
constexpr lnt MOD = 1e9+7;

int main(){
	summon_tourist;

	lnt N, M, K, A[200010], B[200010];
	A[0] = 0, B[0] = 0;
	cin >> N >> M >> K;
	REP(i, N) cin >> A[i+1];
	REP(i, M) cin >> B[i+1];
	REP(i, N) A[i+1] ^= A[i];
	REP(i, M) B[i+1] ^= B[i];

	map<lnt, lnt> aa, bb;
	REP(i, N+1) aa[A[i]]++;
	REP(i, M+1) bb[B[i]]++;

	lnt ans = 0;
	REP(ka, 1024){
		lnt kb = K xor ka;
		lnt cnta = 0, cntb = 0;
		REP(kaa, 1024){
			if(ka == 0) cnta += aa[kaa] * (aa[(ka xor kaa)]-1);
			else cnta += aa[kaa] * aa[(ka xor kaa)];
		}
		cnta /= 2;
		REP(kab, 1024){
			if(kb == 0) cntb += bb[kab] * (bb[(kb xor kab)]-1);
			else cntb += bb[kab] * bb[(kb xor kab)];
		}
		cntb /= 2;
		ans += (cnta*cntb) % MOD;
		ans %= MOD;
	}
	// 0 1 3 0
	// 0 3 7 2
	cout << ans << ln;
}
0