結果

問題 No.1142 XOR と XOR
ユーザー mfbgjsczmfbgjscz
提出日時 2020-08-01 13:19:20
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 2,051 bytes
コンパイル時間 2,041 ms
コンパイル使用メモリ 203,264 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-25 16:35:30
合計ジャッジ時間 3,608 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
6,812 KB
testcase_01 AC 6 ms
6,940 KB
testcase_02 AC 6 ms
6,940 KB
testcase_03 AC 39 ms
6,940 KB
testcase_04 AC 31 ms
6,940 KB
testcase_05 AC 26 ms
6,940 KB
testcase_06 AC 32 ms
6,944 KB
testcase_07 AC 30 ms
6,944 KB
testcase_08 AC 38 ms
6,944 KB
testcase_09 AC 38 ms
6,944 KB
testcase_10 AC 38 ms
6,940 KB
testcase_11 AC 6 ms
6,940 KB
testcase_12 AC 5 ms
6,940 KB
testcase_13 AC 6 ms
6,944 KB
testcase_14 AC 22 ms
6,944 KB
testcase_15 AC 22 ms
6,940 KB
testcase_16 AC 7 ms
6,944 KB
testcase_17 AC 24 ms
6,940 KB
testcase_18 AC 10 ms
6,940 KB
testcase_19 AC 31 ms
6,940 KB
testcase_20 AC 22 ms
6,940 KB
testcase_21 AC 16 ms
6,944 KB
testcase_22 AC 12 ms
6,940 KB
testcase_23 AC 28 ms
6,940 KB
testcase_24 AC 33 ms
6,940 KB
testcase_25 AC 21 ms
6,940 KB
testcase_26 AC 31 ms
6,944 KB
testcase_27 AC 25 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
*/#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
/*namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;
*/#define lli long long int
#define uli unsigned long long int
#define INF 999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long N, M, K;
  cin >> N >> M >> K;
  Vec(P,lli,N+1,0);
  Vec(Q,lli,M+1,0);
  rep(i,1,N+1)cin >> P[i];
  rep(i,1,M+1)cin >> Q[i];
  rep(i,1,N+1)P[i]^=P[i-1];
  rep(i,1,M+1)Q[i]^=Q[i-1];
  DV(A,lli,1024,2,0);
  DV(B,lli,1024,2,0);
  rep(i,0,N+1)A[P[i]][0]++;
  rep(i,0,M+1)B[Q[i]][0]++;
  rep(i,0,1024)rep(j,i,1024) {
    if (i == j) A[0][1] = (A[0][1] + A[i][0] * (A[i][0] - 1) / 2 % mod) % mod; 
    else A[i^j][1] = (A[i^j][1] + A[i][0] * A[j][0] % mod) % mod;
  }
  rep(i,0,1024)rep(j,i,1024) {
    if (i == j) B[0][1] = (B[0][1] + B[i][0] * (B[i][0] - 1) / 2 % mod) % mod;
    else B[i^j][1] = (B[i^j][1] + B[i][0] * B[j][0] % mod) % mod;
  }
  long long sum = 0;
  rep(i,0,1024) sum = ( sum + A[i][1] * B[K^i][1] % mod ) % mod;
  cout << sum << endl;
}
0