結果

問題 No.1142 XOR と XOR
ユーザー firiexpfiriexp
提出日時 2020-07-31 22:06:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,228 bytes
コンパイル時間 839 ms
コンパイル使用メモリ 104,196 KB
実行使用メモリ 4,928 KB
最終ジャッジ日時 2023-09-20 23:30:50
合計ジャッジ時間 3,282 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 62 ms
4,488 KB
testcase_05 AC 51 ms
4,376 KB
testcase_06 AC 63 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 79 ms
4,572 KB
testcase_09 AC 78 ms
4,632 KB
testcase_10 AC 77 ms
4,620 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 42 ms
4,380 KB
testcase_15 AC 41 ms
4,376 KB
testcase_16 AC 6 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 11 ms
4,380 KB
testcase_19 AC 63 ms
4,376 KB
testcase_20 AC 42 ms
4,376 KB
testcase_21 AC 27 ms
4,376 KB
testcase_22 AC 16 ms
4,376 KB
testcase_23 AC 59 ms
4,376 KB
testcase_24 AC 67 ms
4,384 KB
testcase_25 AC 39 ms
4,376 KB
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <bitset>
#include <cmath>

static const int MOD = 1000000007;
using ll = long long;
using u32 = unsigned;
using u64 = unsigned long long;
using namespace std;

template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208;

int main() {
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> A(n+1), B(m+1);
    for (int i = 0; i < n; ++i) {
        cin >> A[i+1];
        A[i+1] ^= A[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> B[i+1];
        B[i+1] ^= B[i];
    }
    vector<ll> cnt(1024), dnt(1024);
    for (auto &&l : A) cnt[l]++;
    for (auto &&l : B) dnt[l]++;
    vector<ll> S(1024), T(1024);
    for (int i = 0; i < 1024; ++i) {
        for (int j = i; j < 1024; ++j) {
            if(i != j){
                S[i^j] += cnt[i]*cnt[j];
                T[i^j] += dnt[i]*dnt[j];
            }else {
                S[0] += cnt[i]*(cnt[i]-1)/2;
                T[0] += dnt[i]*(dnt[i]-1)/2;
            }
        }
    }
    ll ans = 0;
    for (int i = 0; i < 1024; ++i) {
        (ans += S[i]*T[i^k]) %= MOD;
    }
    cout << ans%MOD << "\n";
    return 0;
}
0