結果

問題 No.1142 XOR と XOR
ユーザー trineutrontrineutron
提出日時 2020-08-04 00:55:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,254 bytes
コンパイル時間 2,091 ms
コンパイル使用メモリ 202,364 KB
実行使用メモリ 5,028 KB
最終ジャッジ日時 2023-10-11 21:38:01
合計ジャッジ時間 7,964 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
4,352 KB
testcase_01 AC 5 ms
4,348 KB
testcase_02 WA -
testcase_03 AC 98 ms
4,612 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 60 ms
4,640 KB
testcase_08 AC 80 ms
4,596 KB
testcase_09 AC 81 ms
4,592 KB
testcase_10 AC 81 ms
4,692 KB
testcase_11 RE -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 WA -
testcase_16 RE -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 RE -
testcase_21 WA -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    constexpr int64_t mod = 1000000007;
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> a(n), b(m);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
    }
    for (int i = 0; i < m; i++) {
        cin >> b.at(i);
    }
    
    vector<int64_t> sa(1024), sb(1024);
    sa.at(0) = 1;
    sb.at(0) = 1;
    int s = 0;
    for (int i = 0; i < n; i++) {
        s ^= a.at(i);
        sa.at(s)++;
    }
    s = 0;
    for (int i = 0; i < n; i++) {
        s ^= b.at(i);
        sb.at(s)++;
    }
    
    vector<int64_t> ca(1024), cb(1024);
    for (int i = 0; i < 1024; i++) {
        ca.at(0) += sa.at(i) * (sa.at(i) - 1) / 2;
        ca.at(0) %= mod;
        cb.at(0) += sb.at(i) * (sb.at(i) - 1) / 2;
        cb.at(0) %= mod;
    }
    for (int i = 1; i < 1024; i++) {
        for (int j = 0; j < 1024; j++) {
            if ((i ^ j) >= j) continue;
            ca.at(i) += sa.at(j) * sa.at(i ^ j);
            ca.at(i) %= mod;
            cb.at(i) += sb.at(j) * sb.at(i ^ j);
            cb.at(i) %= mod;
        }
    }
    
    int64_t ans = 0;
    for (int i = 0; i < 1024; i++) {
        ans += ca.at(i) * cb.at(i ^ k);
        ans %= mod;
    }
    cout << ans << endl;
}
0