結果

問題 No.1142 XOR と XOR
ユーザー yupiteru_kunyupiteru_kun
提出日時 2020-07-31 22:48:15
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,481 bytes
コンパイル時間 2,687 ms
コンパイル使用メモリ 203,208 KB
実行使用メモリ 6,848 KB
最終ジャッジ日時 2023-09-21 01:25:49
合計ジャッジ時間 12,990 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 471 ms
5,844 KB
testcase_05 AC 389 ms
5,392 KB
testcase_06 AC 494 ms
6,048 KB
testcase_07 WA -
testcase_08 AC 621 ms
6,508 KB
testcase_09 AC 604 ms
6,520 KB
testcase_10 AC 605 ms
6,520 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 322 ms
5,168 KB
testcase_15 AC 315 ms
5,008 KB
testcase_16 AC 27 ms
4,376 KB
testcase_17 WA -
testcase_18 AC 98 ms
4,376 KB
testcase_19 AC 486 ms
5,904 KB
testcase_20 AC 312 ms
5,064 KB
testcase_21 AC 194 ms
4,380 KB
testcase_22 AC 109 ms
4,376 KB
testcase_23 AC 456 ms
5,736 KB
testcase_24 AC 517 ms
6,068 KB
testcase_25 AC 296 ms
4,928 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];
    }
    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];
    }
    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