結果

問題 No.1863 Xor Sum 2...?
ユーザー Nzt3Nzt3
提出日時 2022-03-04 22:56:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 526 bytes
コンパイル時間 1,551 ms
コンパイル使用メモリ 165,608 KB
実行使用メモリ 4,608 KB
最終ジャッジ日時 2023-09-26 02:09:28
合計ジャッジ時間 3,498 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin>>N;
  vector<int>A(N),B(N);
  for(int &i:A)cin>>i;
  for(int &i:B)cin>>i;
  vector<int>C(N);
  C[0]=B[0];
  for(int i=1;i<N;i++)C[i]=B[i]+C[i-1];
  int ans=0;
  for(int i=0;i<N;i++){
    int t=A[i];
    if(B[i]==0)ans+=1;
    for(int j=1;j<31&&i+j<N;j++){
      if((t&A[i+j])==0){
        if(C[i+j]%2==C[i]%2)ans+=1;
        t|=A[i+j];
      }else{
        break;
      }
    }
  }
  cout<<ans<<'\n';
}
0