結果
| 問題 |
No.1863 Xor Sum 2...?
|
| コンテスト | |
| ユーザー |
たたき@競プロ
|
| 提出日時 | 2023-08-16 17:43:36 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 62 ms / 2,000 ms |
| コード長 | 870 bytes |
| コンパイル時間 | 4,779 ms |
| コンパイル使用メモリ | 309,000 KB |
| 実行使用メモリ | 9,984 KB |
| 最終ジャッジ日時 | 2024-11-25 07:21:47 |
| 合計ジャッジ時間 | 7,716 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#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;
}
たたき@競プロ