結果

問題 No.1863 Xor Sum 2...?
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-08-16 17:43:36
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 870 bytes
コンパイル時間 5,817 ms
コンパイル使用メモリ 307,424 KB
実行使用メモリ 9,832 KB
最終ジャッジ日時 2023-08-16 17:43:47
合計ジャッジ時間 10,464 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 13 ms
4,384 KB
testcase_06 AC 6 ms
4,384 KB
testcase_07 AC 21 ms
5,276 KB
testcase_08 AC 20 ms
5,172 KB
testcase_09 AC 50 ms
8,656 KB
testcase_10 AC 47 ms
8,072 KB
testcase_11 AC 27 ms
6,204 KB
testcase_12 AC 20 ms
5,008 KB
testcase_13 AC 38 ms
6,976 KB
testcase_14 AC 47 ms
8,072 KB
testcase_15 AC 37 ms
7,080 KB
testcase_16 AC 40 ms
7,260 KB
testcase_17 AC 22 ms
5,452 KB
testcase_18 AC 10 ms
4,380 KB
testcase_19 AC 18 ms
5,004 KB
testcase_20 AC 30 ms
6,332 KB
testcase_21 AC 43 ms
7,648 KB
testcase_22 AC 17 ms
4,720 KB
testcase_23 AC 56 ms
8,912 KB
testcase_24 AC 58 ms
9,496 KB
testcase_25 AC 61 ms
9,716 KB
testcase_26 AC 62 ms
9,652 KB
testcase_27 AC 63 ms
9,832 KB
testcase_28 AC 62 ms
9,720 KB
testcase_29 AC 62 ms
9,732 KB
testcase_30 AC 62 ms
9,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint998244353; //1000000007;
using ll=long long;
using pp=pair<int,int>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  int n;cin>>n;
  vc<int>a(n),b(n); rep(i,n)cin>>a[i]; rep(i,n)cin>>b[i];
  int r=0,now=0;
  vc<int>bb(n+1,0); rep(i,n)bb[i+1]=bb[i]^b[i];
  vc bx(n+1,vc<int>(2,0)); rep(i,n+1)bx[i][bb[i]]++;
  rep(i,n)rep(j,2)bx[i+1][j]+=bx[i][j];
  ll ans=0;
  rep(l,n){
   if(r<=l)r=l+1,now^=a[l];
    while(r<n){
      if((now&a[r])!=0)break;
      now^=a[r];
      r++;
    }
    int t=bb[l];
    ans+=bx[r][t]-bx[l][t];
    now^=a[l];
  }
  cout<<ans;
}
  
0