CF698D.Limak and Shooting Points

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Bearland is a dangerous place. Limak can’t travel on foot. Instead, he has kk magic teleportation stones. Each stone can be used at most once. The ii -th stone allows to teleport to a point (axi,ayi)(ax_{i},ay_{i}) . Limak can use stones in any order.

There are nn monsters in Bearland. The ii -th of them stands at (mxi,myi)(mx_{i},my_{i}) .

The given k+nk+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?

输入格式

The first line of the input contains two integers kk and nn ( 1<=k<=71<=k<=7 , 1<=n<=10001<=n<=1000 ) — the number of stones and the number of monsters.

The ii -th of following kk lines contains two integers axiax_{i} and ayiay_{i} ( 109<=axi,ayi<=109-10^{9}<=ax_{i},ay_{i}<=10^{9} ) — coordinates to which Limak can teleport using the ii -th stone.

The ii -th of last nn lines contains two integers mximx_{i} and myimy_{i} ( 109<=mxi,myi<=109-10^{9}<=mx_{i},my_{i}<=10^{9} ) — coordinates of the ii -th monster.

The given k+nk+n points are pairwise distinct.

输出格式

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

输入输出样例

  • 输入#1

    2 4
    -2 -1
    4 5
    4 2
    2 1
    4 -1
    1 -1
    

    输出#1

    3
    
  • 输入#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
    

    输出#2

    5
    

说明/提示

In the first sample, there are two stones and four monsters. Stones allow to teleport to points (2,1)(-2,-1) and (4,5)(4,5) , marked blue in the drawing below. Monsters are at (4,2)(4,2) , (2,1)(2,1) , (4,1)(4,-1) and (1,1)(1,-1) , marked red. A monster at (4,1)(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 33 .

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

首页