結果

問題 No.1142 XOR と XOR
ユーザー tonegawatonegawa
提出日時 2020-08-11 01:24:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,622 bytes
コンパイル時間 939 ms
コンパイル使用メモリ 97,324 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2024-04-17 09:48:26
合計ジャッジ時間 4,062 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 73 ms
5,888 KB
testcase_05 AC 62 ms
5,376 KB
testcase_06 AC 76 ms
5,888 KB
testcase_07 AC 63 ms
6,400 KB
testcase_08 AC 92 ms
6,400 KB
testcase_09 AC 93 ms
6,400 KB
testcase_10 AC 92 ms
6,528 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 WA -
testcase_15 AC 48 ms
5,376 KB
testcase_16 AC 8 ms
5,376 KB
testcase_17 AC 47 ms
5,632 KB
testcase_18 WA -
testcase_19 AC 75 ms
5,888 KB
testcase_20 AC 51 ms
5,376 KB
testcase_21 AC 34 ms
5,376 KB
testcase_22 AC 22 ms
5,376 KB
testcase_23 AC 71 ms
5,632 KB
testcase_24 AC 79 ms
6,016 KB
testcase_25 AC 45 ms
5,376 KB
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d>>(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n, m, k;std::cin >> n >> m >> k;
  //鳩の巣よりそれぞれ2^10種類
  vector<ll> a(n), b(m);
  vector<ll> x(1024, 0), y(1024, 0);
  vector<ll> cnt1(1024, 0), cnt2(1024, 0);

  x[0] = y[0] = 1;
  ll now = 0;
  for(int i=0;i<n;i++){
    ll t;std::cin >> t;
    now^=t;
    x[now]++;
  }
  now = 0;
  for(int i=0;i<m;i++){
    ll t;std::cin >> t;
    now^=t;
    y[now]++;
  }
  ll P = 1000000007;
  for(int i=0;i<1024;i++){
    ll now = x[i];
    if(now==0) continue;
    for(int j=0;j<1024;j++){
      ll to_num = x[j];
      if(i==j) to_num--;
      cnt1[i^j] = (cnt1[i^j] + now * to_num)%P;
    }
  }
  for(int i=0;i<1024;i++){
    ll now = y[i];
    if(now==0) continue;
    for(int j=0;j<1024;j++){
      ll to_num = y[j];
      if(i==j) to_num--;
      cnt2[i^j] = (cnt2[i^j] + now * to_num)%P;
    }
  }
  for(int i=0;i<1024;i++) cnt1[i]/=2, cnt2[i]/=2;
  ll ans = 0;
  for(int i=0;i<1024;i++){
    ll need = k^i;
    ans = (ans + (cnt1[i] * cnt2[need])%P)%P;
  }
  std::cout << ans << '\n';
}
0