結果

問題 No.1142 XOR と XOR
ユーザー catuppercatupper
提出日時 2020-07-31 23:36:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 105 ms / 2,000 ms
コード長 1,355 bytes
コンパイル時間 755 ms
コンパイル使用メモリ 91,332 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:30:41
合計ジャッジ時間 3,177 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
6,816 KB
testcase_01 AC 5 ms
6,940 KB
testcase_02 AC 6 ms
6,940 KB
testcase_03 AC 105 ms
6,940 KB
testcase_04 AC 72 ms
6,940 KB
testcase_05 AC 58 ms
6,940 KB
testcase_06 AC 73 ms
6,944 KB
testcase_07 AC 64 ms
6,940 KB
testcase_08 AC 90 ms
6,940 KB
testcase_09 AC 89 ms
6,940 KB
testcase_10 AC 89 ms
6,944 KB
testcase_11 AC 5 ms
6,940 KB
testcase_12 AC 5 ms
6,944 KB
testcase_13 AC 5 ms
6,940 KB
testcase_14 AC 51 ms
6,940 KB
testcase_15 AC 49 ms
6,944 KB
testcase_16 AC 9 ms
6,940 KB
testcase_17 AC 49 ms
6,944 KB
testcase_18 AC 14 ms
6,940 KB
testcase_19 AC 72 ms
6,940 KB
testcase_20 AC 49 ms
6,940 KB
testcase_21 AC 32 ms
6,940 KB
testcase_22 AC 21 ms
6,944 KB
testcase_23 AC 69 ms
6,940 KB
testcase_24 AC 77 ms
6,940 KB
testcase_25 AC 47 ms
6,940 KB
testcase_26 AC 74 ms
6,940 KB
testcase_27 AC 60 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

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