結果

問題 No.1142 XOR と XOR
ユーザー face4face4
提出日時 2020-08-10 11:54:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 847 ms / 2,000 ms
コード長 931 bytes
コンパイル時間 628 ms
コンパイル使用メモリ 66,688 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:41:31
合計ジャッジ時間 14,230 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,940 KB
testcase_03 AC 847 ms
6,940 KB
testcase_04 AC 665 ms
6,944 KB
testcase_05 AC 542 ms
6,940 KB
testcase_06 AC 675 ms
6,940 KB
testcase_07 AC 802 ms
6,940 KB
testcase_08 AC 847 ms
6,944 KB
testcase_09 AC 847 ms
6,944 KB
testcase_10 AC 826 ms
6,944 KB
testcase_11 AC 2 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 1 ms
6,944 KB
testcase_14 AC 443 ms
6,940 KB
testcase_15 AC 442 ms
6,944 KB
testcase_16 AC 36 ms
6,940 KB
testcase_17 AC 594 ms
6,940 KB
testcase_18 AC 139 ms
6,944 KB
testcase_19 AC 672 ms
6,940 KB
testcase_20 AC 438 ms
6,940 KB
testcase_21 AC 273 ms
6,944 KB
testcase_22 AC 149 ms
6,940 KB
testcase_23 AC 630 ms
6,940 KB
testcase_24 AC 711 ms
6,940 KB
testcase_25 AC 418 ms
6,944 KB
testcase_26 AC 682 ms
6,940 KB
testcase_27 AC 546 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;

int main(){
    int n, m, k;
    cin >> n >> m >> k;
    int a[n], b[m];
    for(int i = 0; i < n; i++)  cin >> a[i];
    for(int i = 0; i < m; i++)  cin >> b[i];
    int acca[1<<10] = {}, accb[1<<10] = {}, ax[1<<10] = {}, bx[1<<10] = {};
    int tmp = 0;
    acca[0] = accb[0] = 1;
    for(int i = 0; i < n; i++){
        tmp ^= a[i];
        for(int j = 0; j < 1<<10; j++){
            ax[j^tmp] += acca[j];
            ax[j^tmp] %= mod;
        }
        acca[tmp]++;
    }
    tmp = 0;
    for(int i = 0; i < m; i++){
        tmp ^= b[i];
        for(int j = 0; j < 1<<10; j++){
            bx[j^tmp] += accb[j];
            bx[j^tmp] %= mod;
        }
        accb[tmp]++;
    }
    ll ans = 0;
    for(int i = 0; i < 1<<10; i++){
        ans += (ll)(ax[i]) * bx[k^i] % mod;
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}
0