結果

問題 No.1142 XOR と XOR
ユーザー mfbgjsczmfbgjscz
提出日時 2020-07-31 22:34:16
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,067 ms / 2,000 ms
コード長 1,892 bytes
コンパイル時間 2,229 ms
コンパイル使用メモリ 205,384 KB
実行使用メモリ 6,164 KB
最終ジャッジ日時 2023-08-07 22:06:40
合計ジャッジ時間 18,727 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 950 ms
6,140 KB
testcase_04 AC 836 ms
5,592 KB
testcase_05 AC 686 ms
5,196 KB
testcase_06 AC 867 ms
5,668 KB
testcase_07 AC 933 ms
6,164 KB
testcase_08 AC 1,067 ms
6,156 KB
testcase_09 AC 1,064 ms
6,120 KB
testcase_10 AC 1,065 ms
6,144 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 533 ms
4,816 KB
testcase_15 AC 519 ms
4,836 KB
testcase_16 AC 43 ms
4,380 KB
testcase_17 AC 702 ms
5,364 KB
testcase_18 AC 156 ms
4,380 KB
testcase_19 AC 857 ms
5,584 KB
testcase_20 AC 553 ms
4,840 KB
testcase_21 AC 335 ms
4,376 KB
testcase_22 AC 190 ms
4,376 KB
testcase_23 AC 802 ms
5,428 KB
testcase_24 AC 910 ms
5,848 KB
testcase_25 AC 473 ms
4,712 KB
testcase_26 AC 794 ms
5,588 KB
testcase_27 AC 660 ms
5,212 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,N){
    A[P[i]][0]--;
    rep(j,0,1024) A[P[i]^j][1] = (A[P[i]^j][1] + A[j][0]) % mod;
  }
  rep(i,0,M){
    B[Q[i]][0]--;
    rep(j,0,1024) B[Q[i]^j][1] = (B[Q[i]^j][1] + B[j][0]) % mod;
  }
  long long sum = 0;
  rep(i,0,1024) sum = ( sum + A[i][1] * B[K^i][1] % mod ) % mod;
  cout << sum << endl;
}
0