結果

問題 No.1142 XOR と XOR
ユーザー yupiteru_kunyupiteru_kun
提出日時 2020-07-31 22:50:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,493 bytes
コンパイル時間 2,666 ms
コンパイル使用メモリ 202,532 KB
実行使用メモリ 6,672 KB
最終ジャッジ日時 2023-09-21 01:31:41
合計ジャッジ時間 22,709 ms
ジャッジサーバーID
(参考情報)
judge15 / 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 921 ms
5,812 KB
testcase_05 AC 749 ms
5,472 KB
testcase_06 AC 944 ms
6,100 KB
testcase_07 WA -
testcase_08 AC 1,157 ms
6,672 KB
testcase_09 AC 1,154 ms
6,476 KB
testcase_10 AC 1,155 ms
6,484 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 601 ms
5,252 KB
testcase_15 AC 589 ms
4,972 KB
testcase_16 AC 50 ms
4,384 KB
testcase_17 WA -
testcase_18 AC 183 ms
4,376 KB
testcase_19 AC 929 ms
5,940 KB
testcase_20 AC 617 ms
5,072 KB
testcase_21 AC 357 ms
4,380 KB
testcase_22 AC 206 ms
4,380 KB
testcase_23 AC 866 ms
5,768 KB
testcase_24 AC 988 ms
6,076 KB
testcase_25 AC 550 ms
4,888 KB
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
#include <bits/stdc++.h>

int main() {
  long long n, m, k;
  std::cin >> n >> m >> k;
  long long aList[n];
  long long bList[m];
  for(int i = 0;i < n;++i) {
    std::cin >> aList[i];
  }
  for(int i = 0;i < m;++i) {
    std::cin >> bList[i];
  }
  long long mod = 1000000007;
  long long aCnts[1024];
  long long bCnts[1024];
  long long *aCnt, *bCnt;
  aCnt = new long long[1024];
  bCnt = new long long[1024];
  for(int i= 0;i < 1024;++i) {
    aCnt[i] = 0;
    bCnt[i] = 0;
    aCnts[i] = 0;
    bCnts[i] = 0;
  }
  for(int i = 0;i < n;++i) {
    long long nextACnt[1024];
    for(int j = 0;j < 1024;++j) {
      nextACnt[j] = 0;
    }
    for(int j = 0;j < 1024;++j) {
      nextACnt[j ^ aList[i]] += aCnt[j];
    }
    nextACnt[aList[i]]++;
    for(int j = 0;j < 1024;++j) {
      aCnt[j] = nextACnt[j] % mod;
    }
    for(int j = 0;j < 1024;++j) {
      aCnts[j] += aCnt[j];
    }
  }
  for(int i = 0;i < m;++i) {
    long long nextBCnt[1024];
    for(int j = 0;j < 1024;++j) {
      nextBCnt[j] = 0;
    }
    for(int j = 0;j < 1024;++j) {
      nextBCnt[j ^ bList[i]] += bCnt[j];
    }
    nextBCnt[bList[i]]++;
    for(int j = 0;j < 1024;++j) {
      bCnt[j] = nextBCnt[j] % mod;
    }
    for(int j = 0;j < 1024;++j) {
      bCnts[j] += bCnt[j];
    }
  }
  long long ans = 0;
  for(int i = 0;i < 1024;++i) {
    ans += aCnts[i] * bCnts[k ^ i];
    ans %= mod;
  }
  std::cout << ans << std::endl;
  return 0;
}

0