結果

問題 No.1142 XOR と XOR
ユーザー ぷらぷら
提出日時 2021-03-08 19:59:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,543 bytes
コンパイル時間 1,606 ms
コンパイル使用メモリ 167,804 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-18 18:14:04
合計ジャッジ時間 4,590 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
5,248 KB
testcase_01 AC 4 ms
5,376 KB
testcase_02 AC 4 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 70 ms
5,376 KB
testcase_05 AC 59 ms
5,376 KB
testcase_06 AC 72 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 89 ms
5,376 KB
testcase_09 AC 87 ms
5,376 KB
testcase_10 AC 86 ms
5,376 KB
testcase_11 AC 4 ms
5,376 KB
testcase_12 AC 4 ms
5,376 KB
testcase_13 AC 4 ms
5,376 KB
testcase_14 AC 49 ms
5,376 KB
testcase_15 AC 47 ms
5,376 KB
testcase_16 AC 7 ms
5,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 71 ms
5,376 KB
testcase_20 AC 48 ms
5,376 KB
testcase_21 AC 31 ms
5,376 KB
testcase_22 AC 19 ms
5,376 KB
testcase_23 AC 68 ms
5,376 KB
testcase_24 AC 74 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pcc = pair<char,char>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pdd = pair<ld,ld>;
using tuplis = array<ll,3>;
template<class T> using prique = priority_queue<T,vector<T>,greater<T>>;
#define rep(i,n) for(ll i = 0; i < n; i++)
#define rrep(i,n) for(ll i = n-1; i >= 0; i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define Sort(a) sort(all(a))
#define Rev(a) reverse(all(a))
#define Uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())
const ll LINF = 1001001001001001001;
const int INF = 1001001001;
const int MOD = 1000000007;
const int MODD = 998244353;
const ld PI = 3.1415926535897932;
const ll dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const ll dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
inline ll popcnt(ll a){ return __builtin_popcountll(a); }
inline ll intpow(ll a, ll b){ ll ans = 1; while(b){ if(b & 1) ans *= a; a *= a; b /= 2; } return ans; }
inline ll modpow(ll a, ll b, ll p){ ll ans = 1; while(b){ if(b & 1) (ans *= a) %= p; (a *= a) %= p; b /= 2; } return ans; }
ll gcd(ll a,ll b){ if(a%b == 0){return b; } else{ return gcd(b,a%b); } }
ll lcm(ll a,ll b){ return a/gcd(a,b)*b; }
template<class T> bool chmin(T& a, const T& b){ if(a > b){ a = b; return 1; } return 0; }
template<class T> bool chmax(T& a, const T& b){ if(a < b){ a = b; return 1; } return 0; }
template<class T, class U> bool chmin(T& a, const U& b){ if(a > T(b)){ a = b; return 1; } return 0; }
template<class T, class U> bool chmax(T& a, const U& b){ if(a < T(b)){ a = b; return 1; } return 0; }
int main() {
    int N,M,K;
    cin >> N >> M >> K;
    vector<int>a(N),b(M);
    vector<int>A(1030),B(1030);
    A[0]++;
    B[0]++;
    int ax = 0,bx = 0;
    rep(i,N) {
        cin >> a[i];
        ax ^= a[i];
        A[ax]++;
    }
    rep(i,M) {
        cin >> b[i];
        bx ^= b[i];
        B[bx]++;
    }
    vector<ll>A2(1030),B2(1030);
    rep(i,1 << 10) {
        for(int j = i; j < (1 << 10); j++) {
            if(i == j) {
                A2[0] += (ll)(A[i]*(A[i]-1)/2);
                A2[0] %= MOD;
                B2[0] += (ll)(B[i]*(B[i]-1)/2);
                B2[0] %= MOD;
            }
            else {
                A2[i^j] += (ll)(A[i]*A[j]);
                A2[i^j] %= MOD;
                B2[i^j] += (ll)(B[i]*B[j]);
                B2[i^j] %= MOD;
            }
        }
    }
    ll ans = 0;
    rep(i,1 << 10) {
        ans += A2[i]*B2[i^K]%MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}
0