結果

問題 No.1142 XOR と XOR
ユーザー shiomusubi496shiomusubi496
提出日時 2020-07-31 22:56:45
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,045 bytes
コンパイル時間 1,705 ms
コンパイル使用メモリ 178,864 KB
実行使用メモリ 6,792 KB
最終ジャッジ日時 2023-09-21 01:45:41
合計ジャッジ時間 6,816 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 60 ms
6,312 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 46 ms
5,348 KB
testcase_18 AC 11 ms
4,376 KB
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<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1000000007;
signed main(){
    int N,M,K;
    cin>>N>>M>>K;
    vector<int> A(N),B(M);
    uint32_t a=0;
    map<uint32_t,int> C,D,E,F;
    C[0]++,D[0]++;
    for(int &i:A){
        cin>>i;
        a^=i;
        C[a]=(C[a]+1)%mod;
    }
    a=0;
    for(int &i:B){
        cin>>i;
        a^=i;
        D[a]=(D[a]+1)%mod;
    }
    if(C.size()==1 && D.size()==1){
        if(K!=0)puts("0");
        else cout<<(N*(N-1)/2%mod+N)%mod*((M*(M-1)/2%mod+M)%mod)%mod<<endl;
        return 0;
    }
    for(pair<uint32_t,int> p1:C){
        for(pair<uint32_t,int> p2:C){
            if(p1<p2)E[p1.first^p2.first]=(E[p1.first^p2.first]+p1.second*p2.second%mod)%mod;
        }
    }
    for(pair<uint32_t,int> p1:D){
        for(pair<uint32_t,int> p2:D){
            if(p1<p2)F[p1.first^p2.first]=(F[p1.first^p2.first]+p1.second*p2.second%mod)%mod;
        }
    }
    int ans=0;
    for(pair<uint32_t,int> p:E)ans=(ans+p.second*F[p.first^K]%mod)%mod;
    cout<<ans<<endl;
}
0