CF575D.Tablecity
普及+/提高
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
There was a big bank robbery in Tablecity. In order to catch the thief, the President called none other than Albert – Tablecity’s Chief of Police. Albert does not know where the thief is located, but he does know how he moves.
Tablecity can be represented as 1000 × 2 grid, where every cell represents one district. Each district has its own unique name “(X, Y)”, where X and Y are the coordinates of the district in the grid. The thief’s movement is as
Every hour the thief will leave the district (X, Y) he is currently hiding in, and move to one of the districts: (X - 1, Y), (X + 1, Y), (X - 1, Y - 1), (X - 1, Y + 1), (X + 1, Y - 1), (X + 1, Y + 1) as long as it exists in Tablecity.
Below is an example of thief’s possible movements if he is located in district (7,1):

Albert has enough people so that every hour he can pick any two districts in Tablecity and fully investigate them, making sure that if the thief is located in one of them, he will get caught. Albert promised the President that the thief will be caught in no more than 2015 hours and needs your help in order to achieve that.
Tablecity 发生了一起大型银行抢劫案。为了抓捕窃贼,总统亲自召见了 Tablecity 的警察局长——阿尔伯特。
阿尔伯特并不知道窃贼当前藏匿于哪个区域,但他清楚窃贼的移动规律。
Tablecity 可被建模为一个 1000×2 的网格,其中每个单元格代表一个行政区。每个行政区拥有唯一的名称 “(X,Y)”,其中 X 和 Y 是该行政区在网格中的坐标。窃贼的移动规则如下:
每过一小时,窃贼将离开他当前藏身的行政区 (X,Y),并移动至以下六个行政区之一(前提是该行政区存在于 Tablecity 内):
(X−1,Y)、(X+1,Y)、(X−1,Y−1)、(X−1,Y+1)、(X+1,Y−1)、(X+1,Y+1)。
下图展示了一个示例:若窃贼当前位于行政区 (7,1),则其可能的移动路径如下所示:

阿尔伯特警力充足,因此每小时他都可以任选 Tablecity 中的两个行政区进行彻底搜查;若窃贼恰好藏身于这两个行政区之一,则必被抓获。阿尔伯特向总统承诺:将在不超过 2015 小时内抓获窃贼。他需要你的帮助来实现这一目标。
输入格式
There is no input for this problem.
本题没有输入。
输出格式
The first line of output contains integer N – duration of police search in hours. Each of the following N lines contains exactly 4 integers _X__i_1, _Y__i_1, _X__i_2, _Y__i_2 separated by spaces, that represent 2 districts (_X__i_1, _Y__i_1), (_X__i_2, _Y__i_2) which got investigated during i-th hour. Output is given in chronological order (i-th line contains districts investigated during i-th hour) and should guarantee that the thief is caught in no more than 2015 hours, regardless of thief’s initial position and movement.
- N ≤ 2015
- 1 ≤ X ≤ 1000
- 1 ≤ Y ≤ 2
输出的第一行包含一个整数 N——警方搜查的持续时间(单位:小时)。接下来的 N 行中,每行恰好包含四个由空格分隔的整数 Xi1, Yi1, Xi2, Yi2,表示在第 i 小时内被调查的两个区域 (Xi1, Yi1) 和 (Xi2, Yi2)。输出按时间顺序给出(即第 i 行对应第 i 小时内调查的区域),且必须保证无论小偷的初始位置及移动方式如何,均可在不超过 2015 小时内将其抓获。
- N≤2015
- 1≤X≤1000
- 1≤Y≤2
输入输出样例
输入#1
В этой задаче нет примеров ввода-вывода. This problem doesn't have sample input and output.
输出#1
Смотрите замечание ниже. See the note below.
说明/提示
Let's consider the following output:
2
5 1 50 2
8 1 80 2
This output is not guaranteed to catch the thief and is not correct. It is given to you only to show the expected output format. There exists a combination of an initial position and a movement strategy such that the police will not catch the thief.
Consider the following initial position and thief’s movement:
In the first hour, the thief is located in district (1,1). Police officers will search districts (5,1) and (50,2) and will not find him.
At the start of the second hour, the thief moves to district (2,2). Police officers will search districts (8,1) and (80,2) and will not find him.
Since there is no further investigation by the police, the thief escaped!
我们考虑以下输出:
2
5 1 50 2
8 1 80 2
该输出无法保证抓获小偷,因此是不正确的。它仅用于向您展示预期的输出格式。存在某种初始位置与移动策略的组合,使得警察无法抓获小偷。
考虑以下初始位置及小偷的移动方式:
第一小时,小偷位于区域 (1,1)。警察将搜查区域 (5,1) 和 (50,2),但无法找到他。
第二小时开始时,小偷移动至区域 (2,2)。警察将搜查区域 (8,1) 和 (80,2),但依然无法找到他。
由于警察不再进行后续搜查,小偷成功逃脱!
输入解题思路,AI测评打分。不知道怎么写?