結果

問題 No.1142 XOR と XOR
ユーザー yakkiyakki
提出日時 2020-08-17 09:08:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 107 ms / 2,000 ms
コード長 1,468 bytes
コンパイル時間 1,215 ms
コンパイル使用メモリ 122,040 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:42:52
合計ジャッジ時間 3,639 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 4 ms
6,944 KB
testcase_02 AC 5 ms
6,944 KB
testcase_03 AC 107 ms
6,940 KB
testcase_04 AC 70 ms
6,944 KB
testcase_05 AC 58 ms
6,940 KB
testcase_06 AC 70 ms
6,944 KB
testcase_07 AC 64 ms
6,940 KB
testcase_08 AC 88 ms
6,940 KB
testcase_09 AC 85 ms
6,944 KB
testcase_10 AC 86 ms
6,940 KB
testcase_11 AC 5 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 5 ms
6,940 KB
testcase_14 AC 49 ms
6,940 KB
testcase_15 AC 49 ms
6,940 KB
testcase_16 AC 8 ms
6,944 KB
testcase_17 AC 52 ms
6,944 KB
testcase_18 AC 14 ms
6,944 KB
testcase_19 AC 70 ms
6,940 KB
testcase_20 AC 46 ms
6,940 KB
testcase_21 AC 29 ms
6,944 KB
testcase_22 AC 20 ms
6,940 KB
testcase_23 AC 69 ms
6,940 KB
testcase_24 AC 71 ms
6,940 KB
testcase_25 AC 44 ms
6,944 KB
testcase_26 AC 68 ms
6,944 KB
testcase_27 AC 54 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int n,m,k; cin >> n >> m >> k;
    vector<int> a(n),b(m);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    vector<int> suma(n+1),sumb(m+1);
    rep(i,n) suma[i+1] = suma[i]^a[i];
    rep(i,m) sumb[i+1] = sumb[i]^b[i];
    vector<ll> cnta(1<<10),cntb(1<<10);
    rep(i,n+1) cnta[suma[i]]++;
    rep(i,m+1) cntb[sumb[i]]++;
    vector<ll> cnta2(1<<10),cntb2(1<<10);
    rep(i,1<<10)repr(j,i,1<<10){
        if(i == j){
            cnta2[i^j] += cnta[i]*(cnta[j]-1)/2;
            cntb2[i^j] += cntb[i]*(cntb[j]-1)/2;
        }
        else{
            cnta2[i^j] += cnta[i]*cnta[j];
            cntb2[i^j] += cntb[i]*cntb[j];
        }
        cnta2[i^j] %= MOD;
        cntb2[i^j] %= MOD;
    }
    ll ans = 0;
    rep(i,1<<10){
        ans += cnta2[i]*cntb2[i^k]%MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

0