結果
問題 |
No.206 数の積集合を求めるクエリ
|
ユーザー |
![]() |
提出日時 | 2025-04-09 21:05:09 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 639 bytes |
コンパイル時間 | 310 ms |
コンパイル使用メモリ | 82,692 KB |
実行使用メモリ | 114,892 KB |
最終ジャッジ日時 | 2025-04-09 21:06:46 |
合計ジャッジ時間 | 12,022 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 TLE * 1 -- * 6 |
ソースコード
import bisect def main(): import sys input = sys.stdin.read().split() ptr = 0 L, M, N = map(int, input[ptr:ptr+3]) ptr +=3 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 A.sort() counter = [0] * Q for b in B: lower = b upper = b + Q - 1 left = bisect.bisect_left(A, lower) right = bisect.bisect_right(A, upper) for a in A[left:right]: v = a - b counter[v] += 1 for cnt in counter: print(cnt) if __name__ == "__main__": main()