CF788D.Finding lines
NOI/NOI+/CTSC
通过率:0%
时间限制:3.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
After some programming contest Roma decided to try himself in tourism. His home country Uzhlyandia is a Cartesian plane. He wants to walk along each of the Main Straight Lines in Uzhlyandia. It is known that each of these lines is a straight line parallel to one of the axes (i.e. it is described with the equation x = a or y = a, where a is integer called the coordinate of this line).
Roma lost his own map, so he should find out the coordinates of all lines at first. Uncle Anton agreed to help him, using the following rules:
- Initially Roma doesn't know the number of vertical and horizontal lines and their coordinates;
- Roma can announce integer coordinates of some point in Uzhlandia, and Anton then will tell him the minimum among the distances from the chosen point to each of the lines. However, since the coordinates of the lines don't exceed 108 by absolute value, Roma can't choose a point with coordinates exceeding 108 by absolute value.
Uncle Anton is in a hurry to the UOI (Uzhlandian Olympiad in Informatics), so he can only answer no more than 3·105 questions.
The problem is that Roma doesn't know how to find out the coordinates of the lines. Write a program that plays Roma's role and finds the coordinates.
在某次编程竞赛之后,罗玛决定尝试旅游。他的祖国乌日兰迪亚(Uzhlyandia)是一个笛卡尔平面。他希望沿乌日兰迪亚的每一条主直线行走。已知这些主直线均平行于坐标轴之一(即每条直线的方程为 x=a 或 y=a,其中整数 a 称为该直线的坐标)。
罗玛弄丢了自己原有的地图,因此他必须首先确定所有主直线的坐标。安东叔叔同意帮助他,规则如下:
- 最初,罗玛既不知道竖直直线与水平直线的数量,也不知道它们各自的坐标;
- 罗玛可以宣布乌日兰迪亚中某个点的整数坐标,安东随即会告诉他:该点到所有主直线的距离中的最小值。但因主直线的坐标绝对值不超过 108,罗玛所选点的坐标绝对值也不能超过 108。
安东叔叔正急着赶去参加乌日兰迪亚信息学奥林匹克竞赛(UOI),因此他最多只能回答 3⋅105 个问题。
问题是:罗玛不知道如何确定这些直线的坐标。请编写一个程序,扮演罗玛的角色,并找出所有主直线的坐标。
输入格式
There is no input initially. Your program should make queries to get information.
It is guaranteed that the number of horizontal and vertical lines is at least 1 and less than or equal to 104 for each type.
初始时没有输入。您的程序应通过查询来获取信息。
保证水平线和垂直线的数量每种均至少为 1,且不超过 104。
输入输出样例
输入#1
1 1 3 2
输出#1
0 1 2 0 -2 -2 0 5 6 0 -2 2 1 1 2 2 0 -3
说明/提示
The example test is
1 2
2
0 -3
The minimum distances are:
- from (1, 2) to x = 2;
- from ( - 2, - 2) to y = - 3;
- from (5, 6) to x = 2;
- from ( - 2, 2) to y = 0.
示例测试用例为:
1 2
2
0 -3
各点到对应直线的最小距离为:
- 点 (1, 2) 到直线 x=2;
- 点 (−2,−2) 到直线 y=−3;
- 点 (5, 6) 到直线 x=2;
- 点 (−2,2) 到直线 y=0。
输入解题思路,AI测评打分。不知道怎么写?