結果

問題 No.206 数の積集合を求めるクエリ
ユーザー tcltk
提出日時 2021-01-15 02:17:48
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 916 bytes
コンパイル時間 314 ms
コンパイル使用メモリ 82,340 KB
実行使用メモリ 209,680 KB
最終ジャッジ日時 2024-11-24 22:40:26
合計ジャッジ時間 54,240 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23 TLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#region Header
#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
from queue import PriorityQueue
import bisect
import heapq

def input():
    return sys.stdin.readline()[:-1]

sys.setrecursionlimit(1000000)
#endregion

# _INPUT = """# paste here...
# """
# sys.stdin = io.StringIO(_INPUT)


def main():
    L, M, N = map(int, input().split())
    A = sorted(list(map(int, input().split())))
    B = sorted(list(map(int, input().split())))
    Q = int(input())

    T = [0 for _ in range(Q)]
    for j in range(M):
        b = B[j]
        k1 = bisect.bisect_left(A, b)
        if k1 == L:
            continue
        k2 = bisect.bisect_right(A, b+(Q-1))
        for k in range(k1, k2):
            a = A[k]
            i = a - b
            T[i] += 1
    for i in range(Q):
        print(T[i])


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