結果

問題 No.1142 XOR と XOR
ユーザー ひばちひばち
提出日時 2020-07-31 22:43:33
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,126 ms / 2,000 ms
コード長 1,286 bytes
コンパイル時間 1,829 ms
コンパイル使用メモリ 197,768 KB
実行使用メモリ 6,040 KB
最終ジャッジ日時 2023-08-07 22:07:38
合計ジャッジ時間 15,585 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 531 ms
5,768 KB
testcase_04 AC 773 ms
5,352 KB
testcase_05 AC 617 ms
5,076 KB
testcase_06 AC 881 ms
5,436 KB
testcase_07 AC 523 ms
5,784 KB
testcase_08 AC 1,125 ms
5,764 KB
testcase_09 AC 1,126 ms
5,828 KB
testcase_10 AC 1,125 ms
6,040 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 352 ms
4,928 KB
testcase_15 AC 324 ms
4,744 KB
testcase_16 AC 21 ms
4,380 KB
testcase_17 AC 412 ms
5,560 KB
testcase_18 AC 103 ms
4,508 KB
testcase_19 AC 906 ms
5,372 KB
testcase_20 AC 305 ms
4,908 KB
testcase_21 AC 210 ms
4,376 KB
testcase_22 AC 98 ms
4,376 KB
testcase_23 AC 837 ms
5,256 KB
testcase_24 AC 931 ms
5,456 KB
testcase_25 AC 299 ms
4,804 KB
testcase_26 AC 448 ms
5,440 KB
testcase_27 AC 368 ms
5,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;

#define rep(i, N) for (int i = 0; i < (int)(N); ++i)
#define rrep(i, N) for (int i = (int)(N)-1; i >= 0; --i)
#define debug(x) cout << #x << "=" << x << endl;
constexpr int MOD=1000000007;
constexpr ll INF = (1LL << 61) - 1;
template <class T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;} return false;}
template <typename T> void fail(T v){cout << v << endl;exit(0);}
//template

void solve(){
    int N,M,K;scanf("%d %d %d",&N,&M,&K);
    int A[201010],B[201010],S[201010],ct[1<<10];ll D[1<<10];
    memset(ct,0,sizeof(ct));
    memset(D,0,sizeof(D));
    S[0]=0;
    rep(i,N){scanf("%d",&A[i]);S[i+1]=S[i]^A[i];ct[S[i+1]]++;}
    rep(i,N){
        rep(j,1<<10){D[j^S[i]]+=ct[j];}
        ct[S[i+1]]--;
    }
    memset(ct,0,sizeof(ct));
    rep(i,M){scanf("%d",&B[i]);S[i+1]=S[i]^B[i];ct[S[i+1]]++;}
    ll res=0;
    rep(i,M){
        rep(j,1<<10){res+=D[j^S[i]^K]*ct[j];if(res>=MOD)res%=MOD;}
        ct[S[i+1]]--;
    }
    cout<<res<<endl;
}

int main(){
    //cin.tie(0);
    //ios::sync_with_stdio(false);
    //cout << fixed << setprecision(20);
    solve();
    return 0;
}
0