結果

問題 No.1142 XOR と XOR
ユーザー yakkiyakki
提出日時 2020-08-17 09:07:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,469 bytes
コンパイル時間 1,136 ms
コンパイル使用メモリ 122,932 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-19 18:40:40
合計ジャッジ時間 3,984 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 4 ms
6,940 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 WA -
testcase_04 AC 64 ms
6,944 KB
testcase_05 AC 53 ms
6,940 KB
testcase_06 AC 66 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 84 ms
6,944 KB
testcase_09 AC 81 ms
6,944 KB
testcase_10 AC 82 ms
6,940 KB
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 3 ms
6,940 KB
testcase_14 AC 43 ms
6,940 KB
testcase_15 AC 44 ms
6,940 KB
testcase_16 AC 6 ms
6,944 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 66 ms
6,940 KB
testcase_20 AC 44 ms
6,940 KB
testcase_21 AC 30 ms
6,944 KB
testcase_22 AC 17 ms
6,944 KB
testcase_23 AC 62 ms
6,944 KB
testcase_24 AC 70 ms
6,940 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

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<int> 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