Codeforces Round 363 (Div. 2)
F
Limak and Shooting Points
Codeforces
未评级
原题
← E→
翻译中…

Bearland is a dangerous place. Limak can’t travel on foot. Instead, he has $*k*$ magic teleportation stones. Each stone can be used at most once. The $*i*$-th stone allows to teleport to a point $(*ax*_{*i*}, *ay*_{*i*})$. Limak can use stones in any order.

翻译中…

There are $*n*$ monsters in Bearland. The $*i*$-th of them stands at $(*mx*_{*i*}, *my*_{*i*})$.

翻译中…

The given $*k* + *n*$ points are pairwise distinct.

翻译中…

After each teleportation, Limak can shoot an arrow in some direction. An arrow will hit the first monster in the chosen direction. Then, both an arrow and a monster disappear. It’s dangerous to stay in one place for long, so Limak can shoot only one arrow from one place.

翻译中…

A monster should be afraid if it’s possible that Limak will hit it. How many monsters should be afraid of Limak?

翻译中…

Input

翻译中…

The first line of the input contains two integers $*k*$ and $*n*$ ($1 ≤ *k* ≤ 7$, $1 ≤ *n* ≤ 1000$) — the number of stones and the number of monsters.

翻译中…

The $*i*$-th of following $*k*$ lines contains two integers $*ax*_{*i*}$ and $*ay*_{*i*}$ ($- 10^{9} ≤ *ax*_{*i*}, *ay*_{*i*} ≤ 10^{9}$) — coordinates to which Limak can teleport using the $*i*$-th stone.

翻译中…

The $*i*$-th of last $*n*$ lines contains two integers $*mx*_{*i*}$ and $*my*_{*i*}$ ($- 10^{9} ≤ *mx*_{*i*}, *my*_{*i*} ≤ 10^{9}$) — coordinates of the $*i*$-th monster.

翻译中…

The given $*k* + *n*$ points are pairwise distinct.

翻译中…

Output

翻译中…

Print the number of monsters which should be afraid of Limak.

翻译中…

Note

翻译中…

In the first sample, there are two stones and four monsters. Stones allow to teleport to points $( - 2,  - 1)$ and $(4, 5)$, marked blue in the drawing below. Monsters are at $(4, 2)$, $(2, 1)$, $(4,  - 1)$ and $(1,  - 1)$, marked red. A monster at $(4,  - 1)$ shouldn't be afraid because it's impossible that Limak will hit it with an arrow. Other three monsters can be hit and thus the answer is $3$.

翻译中…

image

翻译中…

In the second sample, five monsters should be afraid. Safe monsters are those at $(300, 600)$, $(170, 340)$ and $(90, 180)$.

翻译中…

样例

Input #1
2 4
-2 -1
4 5
4 2
2 1
4 -1
1 -1
Output #1
3
InputCopy OutputCopy
Input #2
3 8
10 20
0 0
20 40
300 600
30 60
170 340
50 100
28 56
90 180
-4 -8
-1 -2
Output #2
5
InputCopy OutputCopy
题目信息
题号
699F
时间限制
3 s
内存限制
256 MB

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