CF33D.Knights

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Berland is facing dark times again. The army of evil lord Van de Mart is going to conquer the whole kingdom. To the council of war called by the Berland's king Valery the Severe came nn knights. After long discussions it became clear that the kingdom has exactly nn control points (if the enemy conquers at least one of these points, the war is lost) and each knight will occupy one of these points.

Berland is divided into m+1m+1 regions with mm fences, and the only way to get from one region to another is to climb over the fence. Each fence is a circle on a plane, no two fences have common points, and no control point is on the fence. You are given kk pairs of numbers aia_{i} , bib_{i} . For each pair you have to find out: how many fences a knight from control point with index aia_{i} has to climb over to reach control point bib_{i} (in case when Van de Mart attacks control point bib_{i} first). As each knight rides a horse (it is very difficult to throw a horse over a fence), you are to find out for each pair the minimum amount of fences to climb over.

输入格式

The first input line contains three integers nn , mm , kk ( 1<=n,m<=10001<=n,m<=1000 , 0<=k<=1000000<=k<=100000 ). Then follow nn lines, each containing two integers KxiKx_{i} , KyiKy_{i} ( 109<=Kxi,Kyi<=109-10^{9}<=Kx_{i},Ky_{i}<=10^{9} ) — coordinates of control point with index ii . Control points can coincide.

Each of the following mm lines describes fence with index ii with three integers rir_{i} , CxiCx_{i} , CyiCy_{i} ( 1<=ri<=1091<=r_{i}<=10^{9} , 109<=Cxi,Cyi<=109-10^{9}<=Cx_{i},Cy_{i}<=10^{9} ) — radius and center of the circle where the corresponding fence is situated.

Then follow kk pairs of integers aia_{i} , bib_{i} ( 1<=ai,bi<=n1<=a_{i},b_{i}<=n ), each in a separate line — requests that you have to answer. aia_{i} and bib_{i} can coincide.

输出格式

Output exactly kk lines, each containing one integer — the answer to the corresponding request.

输入输出样例

  • 输入#1

    2 1 1
    0 0
    3 3
    2 0 0
    1 2
    

    输出#1

    1
    
  • 输入#2

    2 3 1
    0 0
    4 4
    1 0 0
    2 0 0
    3 0 0
    1 2
    

    输出#2

    3
    
首页