結果

問題 No.1142 XOR と XOR
ユーザー catuppercatupper
提出日時 2020-07-31 23:36:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,355 bytes
コンパイル時間 714 ms
コンパイル使用メモリ 83,640 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-21 03:12:00
合計ジャッジ時間 3,338 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,376 KB
testcase_01 AC 4 ms
4,380 KB
testcase_02 AC 4 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 5 ms
4,380 KB
testcase_12 AC 4 ms
4,500 KB
testcase_13 AC 4 ms
4,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<complex>
using namespace std;
#define MOD 1000000007
#define MOD2 998244353
#define INF (1<<29)
#define LINF (1LL<<60)
#define EPS (1e-10)
#define PI 3.1415926535897932384626433832795028
typedef long long Int;
typedef pair<Int, Int> P;
typedef long double Real;
typedef complex<Real> CP;

int a, b;
int accum_a, accum_b;
int cnt_a[1 << 10], cnt_b[1 << 10];
int pcnt_a[1<<10], pcnt_b[1<<10];
int n, m, k;
int main(){
    cin >> n >> m >> k;
    cnt_a[0]++;
    for(int i = 0;i < n;i++){
        cin >> a;
        accum_a ^= a;
        cnt_a[accum_a]++;
    }
    cnt_b[0]++;
    for(int i = 0;i < m;i++){
        cin >> b;
        accum_b ^= b;
        cnt_b[accum_b]++;
    }

    for(int i = 0;i < (1 << 10);i++){
        (pcnt_a[0] += cnt_a[i] * (cnt_a[i]-1) / 2) %= MOD;
        (pcnt_b[0] += cnt_b[i] * (cnt_b[i]-1) / 2) %= MOD;
        for(int j = i+1;j < (1 << 10);j++){
            (pcnt_a[i^j] += cnt_a[i] * cnt_a[j] % MOD) %= MOD;
            (pcnt_b[i^j] += cnt_b[i] * cnt_b[j] % MOD) %= MOD;
        }
    }
    Int ans = 0;
    for(int i = 0;i < (1<<10);i++){
        (ans += pcnt_a[i] * pcnt_b[i^k] % MOD) %= MOD;  
    }

    cout << ans << endl;    
    return 0;
}
0