結果

問題 No.1142 XOR と XOR
ユーザー ShibuyapShibuyap
提出日時 2020-07-31 21:59:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 821 ms / 2,000 ms
コード長 1,233 bytes
コンパイル時間 2,128 ms
コンパイル使用メモリ 195,864 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:17:11
合計ジャッジ時間 15,076 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 AC 821 ms
6,940 KB
testcase_04 AC 639 ms
6,940 KB
testcase_05 AC 521 ms
6,940 KB
testcase_06 AC 656 ms
6,940 KB
testcase_07 AC 779 ms
6,944 KB
testcase_08 AC 801 ms
6,944 KB
testcase_09 AC 804 ms
6,940 KB
testcase_10 AC 800 ms
6,944 KB
testcase_11 AC 3 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 3 ms
6,940 KB
testcase_14 AC 438 ms
6,944 KB
testcase_15 AC 427 ms
6,940 KB
testcase_16 AC 37 ms
6,944 KB
testcase_17 AC 588 ms
6,944 KB
testcase_18 AC 133 ms
6,944 KB
testcase_19 AC 649 ms
6,940 KB
testcase_20 AC 419 ms
6,940 KB
testcase_21 AC 258 ms
6,940 KB
testcase_22 AC 144 ms
6,944 KB
testcase_23 AC 615 ms
6,944 KB
testcase_24 AC 694 ms
6,940 KB
testcase_25 AC 395 ms
6,940 KB
testcase_26 AC 653 ms
6,940 KB
testcase_27 AC 519 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("YES");}else{puts("NO");}
#define MAX_N 200005

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    int a[n], b[m];
    rep(i,n)cin >> a[i];
    rep(i,m)cin >> b[i];
    ll cnta[1024] = {};
    ll cntb[1024] = {};
    ll fa[1024] = {};
    ll fb[1024] = {};
    ll MOD = 1000000007;
    int now = 0;
    rep(i,n){
        now ^= a[i];
        cnta[now]++;
        rep(j,1024){
            cnta[j^now] += fa[j];
            cnta[j^now] %= MOD;
        }
        fa[now]++;
    }
    now = 0;
    rep(i,m){
        now ^= b[i];
        cntb[now]++;
        rep(j,1024){
            cntb[j^now] += fb[j];
            cntb[j^now] %= MOD;
        }
        fb[now]++;
    }

    /*
    rep(i,10) cout << cnta[i] << ' ';
    cout << endl;
    */

    ll ans = 0;
    rep(i,1024){
        rep(j,1024){
            if((i^j) == k){
                ans += cnta[i] * cntb[j];
                ans %= MOD;
            }
        }
    }

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