CF491B.New York Hotel

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

Think of New York as a rectangular grid consisting of NN vertical avenues numerated from 11 to NN and MM horizontal streets numerated 11 to MM . CC friends are staying at CC hotels located at some street-avenue crossings. They are going to celebrate birthday of one of them in the one of HH restaurants also located at some street-avenue crossings. They also want that the maximum distance covered by one of them while traveling to the restaurant to be minimum possible. Help friends choose optimal restaurant for a celebration.

Suppose that the distance between neighboring crossings are all the same equal to one kilometer.

输入格式

The first line contains two integers NN и MM — size of the city ( 1<=N,M<=1091<=N,M<=10^{9} ). In the next line there is a single integer CC ( 1<=C<=1051<=C<=10^{5} ) — the number of hotels friends stayed at. Following CC lines contain descriptions of hotels, each consisting of two coordinates xx and yy ( 1<=x<=N1<=x<=N , 1<=y<=M1<=y<=M ). The next line contains an integer HH — the number of restaurants ( 1<=H<=1051<=H<=10^{5} ). Following HH lines contain descriptions of restaurants in the same format.

Several restaurants and hotels may be located near the same crossing.

输出格式

In the first line output the optimal distance. In the next line output index of a restaurant that produces this optimal distance. If there are several possibilities, you are allowed to output any of them.

输入输出样例

  • 输入#1

    10 10
    2
    1 1
    3 3
    2
    1 10
    4 4
    

    输出#1

    6
    2
    
首页