結果

問題 No.1296 OR or NOR
ユーザー googol_S0googol_S0
提出日時 2020-11-20 22:20:04
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 446 ms
コンパイル使用メモリ 87,032 KB
実行使用メモリ 133,480 KB
最終ジャッジ日時 2023-09-30 19:30:23
合計ジャッジ時間 31,813 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
71,292 KB
testcase_01 AC 74 ms
71,336 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1,180 ms
125,948 KB
testcase_05 WA -
testcase_06 AC 583 ms
133,480 KB
testcase_07 AC 572 ms
133,340 KB
testcase_08 AC 530 ms
132,672 KB
testcase_09 AC 656 ms
125,904 KB
testcase_10 AC 676 ms
125,568 KB
testcase_11 AC 666 ms
118,068 KB
testcase_12 AC 635 ms
116,588 KB
testcase_13 AC 656 ms
114,380 KB
testcase_14 AC 2,420 ms
126,260 KB
testcase_15 AC 1,394 ms
118,220 KB
testcase_16 AC 1,203 ms
118,508 KB
testcase_17 AC 582 ms
133,008 KB
testcase_18 AC 595 ms
133,208 KB
testcase_19 AC 603 ms
133,136 KB
testcase_20 AC 534 ms
115,040 KB
testcase_21 AC 520 ms
115,572 KB
testcase_22 AC 445 ms
114,964 KB
testcase_23 AC 458 ms
115,624 KB
testcase_24 AC 470 ms
114,912 KB
testcase_25 AC 474 ms
114,548 KB
testcase_26 AC 522 ms
114,444 KB
testcase_27 AC 527 ms
114,764 KB
testcase_28 AC 510 ms
115,684 KB
testcase_29 AC 488 ms
114,236 KB
testcase_30 AC 1,617 ms
118,320 KB
testcase_31 AC 1,621 ms
118,240 KB
testcase_32 AC 1,614 ms
118,356 KB
testcase_33 AC 811 ms
116,040 KB
testcase_34 AC 808 ms
115,924 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
B=list(map(int,input().split()))
X=[-1]*60
for i in range(60):
  for j in range(N-1,-1,-1):
    if A[j]&(1<<i):
      X[i]=max(1,j)
      break
for i in range(Q):
  Y,Z=set(),set()
  for j in range(60):
    if B[i]&(1<<j):
      Y.add(X[j])
    else:
      Z.add(X[j])
  #print(Y,Z)
  if len(Y&Z):
    print(-1)
  else:
    V=sorted(Y|Z,reverse=True)
    P=0
    for j in range(len(V)):
      if V[j] in Y:
        if (P&1)^(V[j]==-1):
          P+=1
      else:
        if (P&1)^(V[j]!=-1):
          P+=1
    print(P)
0