結果

問題 No.206 数の積集合を求めるクエリ
ユーザー Mao-beta
提出日時 2024-04-06 17:37:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 5,786 ms / 7,000 ms
コード長 917 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 99,344 KB
最終ジャッジ日時 2024-10-01 03:56:42
合計ジャッジ時間 43,390 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import math
import bisect
from heapq import heapify, heappop, heappush
from collections import deque, defaultdict, Counter
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product

sys.set_int_max_str_digits(10 ** 6)
sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
MOD99 = 998244353

input = lambda: sys.stdin.readline().strip()
NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()
SMI = lambda: input().split()
SLI = lambda: list(SMI())
EI = lambda m: [NLI() for _ in range(m)]


def main():
    L, M, N = NMI()
    A = NLI()
    B = NLI()
    Q = NI()
    X = 0
    Y = 0
    for a in A:
        X |= 1<<a
    for b in B:
        Y |= 1<<b
    ans = [0] * Q
    for i in range(Q):
        ans[i] = (X&Y).bit_count()
        Y <<= 1
    print(*ans, sep="\n")


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