結果

問題 No.1142 XOR と XOR
ユーザー ゆきのんゆきのん
提出日時 2020-08-30 22:05:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,611 bytes
コンパイル時間 1,373 ms
コンパイル使用メモリ 169,948 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-27 13:28:17
合計ジャッジ時間 4,267 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,816 KB
testcase_01 AC 4 ms
6,940 KB
testcase_02 AC 3 ms
6,940 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 4 ms
6,940 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 AC 4 ms
6,944 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

 
int main(){
    int n,m,k;cin >> n >> m >> k;
    vector<int> a(n),b(m);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
    }
    vector<int> ac(1<<11, 0), bc(1<<11, 0);
    int A = 0, B = 0;
    ac[0]++;
    for (int i = 0; i < n; i++) {
        A ^= a[i];
        ac[A]++;
    }
    bc[0]++;
    for (int i = 0; i < m; i++) {
        B ^= b[i];
        bc[B]++;
    }
    vector<int> aa(1<<11, 0), bb(1<<11, 0);
    for (int i = 0; i < 1<<10; i++) {
        aa[i ^ i] = (aa[i ^ i] + ac[i] * (ac[i] - 1) / 2)%mod;
        bb[i ^ i] = (bb[i ^ i] + bc[i] * (bc[i] - 1) / 2)%mod;
        for (int j = i + 1; j < 1<<10; j++) {
            aa[i ^ j] = (aa[i ^ j] + ac[i] * ac[j]) %mod;
            bb[i ^ j] = (bb[i ^ j] + bc[i] * bc[j]) %mod;
        }
    }
    LL ans = 0;
    for (int i = 0; i < 1<<10; i++) {
        ans = (ans + aa[i] * bb[i ^ k])%mod;
    }
    cout << ans << endl;
    return 0;
}
0