結果

問題 No.206 数の積集合を求めるクエリ
ユーザー gew1fw
提出日時 2025-06-12 19:51:28
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 669 bytes
コンパイル時間 196 ms
コンパイル使用メモリ 82,552 KB
実行使用メモリ 113,536 KB
最終ジャッジ日時 2025-06-12 19:51:58
合計ジャッジ時間 15,813 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 TLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    import sys
    input = sys.stdin.read().split()
    ptr = 0

    L = int(input[ptr])
    ptr += 1
    M = int(input[ptr])
    ptr += 1
    N = int(input[ptr])
    ptr += 1

    A = list(map(int, input[ptr:ptr+L]))
    ptr += L
    B = list(map(int, input[ptr:ptr+M]))
    ptr += M
    Q = int(input[ptr])
    ptr += 1

    # Construct maskA and maskB
    maskA = 0
    for a in A:
        maskA |= 1 << a
    maskB = 0
    for b in B:
        maskB |= 1 << b

    for v in range(Q):
        maskBv = maskB << v
        intersection = maskA & maskBv
        count = bin(intersection).count('1')
        print(count)

if __name__ == '__main__':
    main()
0