結果

問題 No.206 数の積集合を求めるクエリ
ユーザー ntuda
提出日時 2025-01-28 22:27:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 5,731 ms / 7,000 ms
コード長 607 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 82,684 KB
実行使用メモリ 103,636 KB
最終ジャッジ日時 2025-01-28 22:27:51
合計ジャッジ時間 35,971 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

L,M,N = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

BN = 50
n = N//BN + 1
A2 = [0] * (n)
B2 = [0] * (n)
of = 1 << BN
for a in A:
    x = a // BN
    y = a % BN
    A2[x] ^= (1 << y)
for b in B:
    x = b // BN
    y = b % BN
    B2[x] ^= (1 << y)
for i in range(int(input())):
    ans = 0
    for j in range(n):
        ans += (A2[j] & B2[j]).bit_count()
    print(ans)
    carry = 0
    for i in range(n):
        B2[i] <<= 1
        B2[i] |= carry
        if B2[i] & of:
            carry = 1
            B2[i] ^= of
        else:
            carry = 0
0