結果
| 問題 |
No.206 数の積集合を求めるクエリ
|
| コンテスト | |
| ユーザー |
qwewe
|
| 提出日時 | 2025-04-24 12:28:25 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 775 bytes |
| コンパイル時間 | 256 ms |
| コンパイル使用メモリ | 82,816 KB |
| 実行使用メモリ | 115,732 KB |
| 最終ジャッジ日時 | 2025-04-24 12:30:48 |
| 合計ジャッジ時間 | 12,390 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 = 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
B_sorted = sorted(B)
cnt = [0] * Q
for x in A:
min_y = x - (Q - 1)
max_y = x
left = bisect.bisect_left(B_sorted, min_y)
right = bisect.bisect_right(B_sorted, max_y)
for y in B_sorted[left:right]:
v = x - y
if 0 <= v < Q:
cnt[v] += 1
for v in range(Q):
print(cnt[v])
if __name__ == '__main__':
main()
qwewe