A9726 | New York Hotel
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Think of New York as a rectangular grid consisting of $N$ vertical avenues numerated from $1$ to $N$ and $M$ horizontal streets numerated $1$ to $M$ . $C$ friends are staying at $C$ hotels located at some street-avenue crossings. They are going to celebrate birthday of one of them in the one of $H$ 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.
Suppose that the distance between neighboring crossings are all the same equal to one kilometer.
输入格式
The first line contains two integers $N$ и $M$ — size of the city ( $1<=N,M<=10^{9}$ ). In the next line there is a single integer $C$ ( $1<=C<=10^{5}$ ) — the number of hotels friends stayed at. Following $C$ lines contain descriptions of hotels, each consisting of two coordinates $x$ and $y$ ( $1<=x<=N$ , $1<=y<=M$ ). The next line contains an integer $H$ — the number of restaurants ( $1<=H<=10^{5}$ ). Following $H$ lines contain descriptions of restaurants in the same format.
Several restaurants and hotels may be located near the same crossing.
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
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted