Codeforces Beta Round 72 (Div. 2 Only)
C
Biathlon
Codeforces
1700
原题
← BD →
翻译中…

Perhaps many have heard that the World Biathlon Championship has finished. Although our hero Valera was not present at this spectacular event himself and only watched it on TV, it excited him so much that he decided to enroll in a biathlon section.

翻译中…

Of course, biathlon as any sport, proved very difficult in practice. It takes much time and effort. Workouts, workouts, and workouts, — that's what awaited Valera on his way to great achievements in biathlon.

翻译中…

As for the workouts, you all probably know that every professional biathlete should ski fast and shoot precisely at the shooting range. Only in this case you can hope to be successful, because running and shooting are the two main components of biathlon. Valera has been diligent in his ski trainings, which is why he runs really fast, however, his shooting accuracy is nothing to write home about.

翻译中…

On a biathlon base where Valera is preparing for the competition, there is a huge rifle range with $*n*$ targets. Each target have shape of a circle, and the center of each circle is located on the $*Ox*$ axis. At the last training session Valera made the total of $*m*$ shots. To make monitoring of his own results easier for him, one rather well-known programmer (of course it is you) was commissioned to write a program that would reveal how many and which targets Valera hit. More specifically, for each target the program must print the number of the first successful shot (in the target), or "-1" if this was not hit. The target is considered hit if the shot is inside the circle or on its boundary. Valera is counting on you and perhaps, thanks to you he will one day win international competitions.

翻译中…

Input

翻译中…

The first line of the input file contains the integer $*n*$ ($1 ≤ *n* ≤ 10^{4}$), which is the number of targets. The next $*n*$ lines contain descriptions of the targets. Each target is a circle whose center is located on the $*Ox*$ axis. Each circle is given by its coordinate of the center $*x*$ ($- 2·10^{4} ≤ *x* ≤ 2·10^{4}$) and its radius $*r*$ ($1 ≤ *r* ≤ 1000$). It is guaranteed that no two targets coincide, intersect or are nested into each other, but they can touch each other.

翻译中…

The next line contains integer $*m*$ ($1 ≤ *m* ≤ 2·10^{5}$), which is the number of shots. Next $*m*$ lines contain descriptions of the shots, which are points on the plane, given by their coordinates $*x*$ and $*y*$ ($- 2·10^{4} ≤ *x*, *y* ≤ 2·10^{4}$).

翻译中…

All the numbers in the input are integers.

翻译中…

Targets and shots are numbered starting from one in the order of the input.

翻译中…

Output

翻译中…

Print on the first line a single number, the number of targets hit by Valera. Print on the second line for each of the targets the number of its first hit or "-1" (without quotes) if this number does not exist. Separate numbers with spaces.

翻译中…

样例

Input #1
3
2 1
5 2
10 1
5
0 1
1 3
3 0
4 0
4 0
Output #1
2
3 3 -1
InputCopy OutputCopy
Input #2
3
3 2
7 1
11 2
4
2 1
6 0
6 4
11 2
Output #2
3
1 2 4
InputCopy OutputCopy
题目信息
题号
84C
时间限制
1 s
内存限制
256 MB
标签
二分
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。