結果

問題 No.1142 XOR と XOR
ユーザー betrue12betrue12
提出日時 2020-09-01 02:18:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 851 ms / 2,000 ms
コード長 700 bytes
コンパイル時間 2,060 ms
コンパイル使用メモリ 195,996 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:44:05
合計ジャッジ時間 15,630 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 849 ms
6,940 KB
testcase_04 AC 665 ms
6,940 KB
testcase_05 AC 539 ms
6,940 KB
testcase_06 AC 685 ms
6,944 KB
testcase_07 AC 819 ms
6,940 KB
testcase_08 AC 848 ms
6,944 KB
testcase_09 AC 842 ms
6,940 KB
testcase_10 AC 851 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 1 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 452 ms
6,944 KB
testcase_15 AC 445 ms
6,944 KB
testcase_16 AC 37 ms
6,940 KB
testcase_17 AC 613 ms
6,944 KB
testcase_18 AC 138 ms
6,940 KB
testcase_19 AC 682 ms
6,940 KB
testcase_20 AC 443 ms
6,944 KB
testcase_21 AC 279 ms
6,940 KB
testcase_22 AC 153 ms
6,940 KB
testcase_23 AC 649 ms
6,940 KB
testcase_24 AC 725 ms
6,940 KB
testcase_25 AC 417 ms
6,940 KB
testcase_26 AC 673 ms
6,944 KB
testcase_27 AC 544 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}


int main(){
    int N[2], K;
    cin >> N[0] >> N[1] >> K;
    static int64_t num[2][1024], sum[2][1024];
    for(int t=0; t<2; t++){
        int s = 0;
        num[t][0] = 1;
        for(int i=0; i<N[t]; i++){
            int a;
            cin >> a;
            s ^= a;
            for(int k=0; k<1024; k++) add(sum[t][k^s], num[t][k]);
            add(num[t][s], 1);
        }
    }

    int64_t ans = 0;
    for(int k=0; k<1024; k++) add(ans, sum[0][k] * sum[1][k^K]);
    cout << ans << endl;
    return 0;
}
0