AtCoder Regular Contest 092/AtCoder Beginner Contest 091 D問題 - Two Sequences

Source

AtCoder Regular Contest 092
AtCoder Beginner Contest 091
問題文 (ARC)
問題文 (ABC)

問題概要

省略

解法

省略

cLayversion 20191111-1)のコード

C++に変換後のコードはこちら

int N, A[2d5], B[2d5];

int a0s, a0[2d5], a1s, a1[2d5];
int b0s, b0[2d5], b1s, b1[2d5];

{
  int res = 0, all;
  rd(N,A(N),B(N));
  rrep(bt,30){
    all = (1<<(bt+1)) - 1;
    a0s = a1s = b0s = b1s = 0;
    rep(i,N){
      if(BIT_ith(A[i],bt)) a1[a1s++] = (A[i]&all) ^ BIT_ith(bt);
      else                 a0[a0s++] = (A[i]&all);
      if(BIT_ith(B[i],bt)) b1[b1s++] = (B[i]&all) ^ BIT_ith(bt);
      else                 b0[b0s++] = (B[i]&all);
    }
    sortA(a0s, a0); sortA(a1s, a1);
    sortA(b0s, b0); sortA(b1s, b1);
    if(counterSumIsLT(a0s, a0, b1s, b1, BIT_ith(bt)) % 2) res ^= BIT_ith(bt);
    if(counterSumIsLT(a1s, a1, b0s, b0, BIT_ith(bt)) % 2) res ^= BIT_ith(bt);
    if(((ll) a0s * b0s - counterSumIsLT(a0s, a0, b0s, b0, BIT_ith(bt))) % 2) res ^= BIT_ith(bt);
    if(((ll) a1s * b1s - counterSumIsLT(a1s, a1, b1s, b1, BIT_ith(bt))) % 2) res ^= BIT_ith(bt);
  }
  wt(res);
}

Current time: 2021年09月28日08時14分39秒
Last modified: 2019年11月11日02時25分22秒 (by laycrs)
Tags: Competitive_Programming_Incomplete AtCoder AtCoder_Regular_Contest AtCoder_Beginner_Contest ARC092 ABC091 ARC_B ABC_D
トップページに戻る

Logged in as: unknown user (not login)

ログイン: