Bubble Cup 8 - Finals [Online Mirror]
来源:互联网 发布:机器人编程实战 编辑:程序博客网 时间:2024/05/16 15:31
D. Tablecity time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output
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.
Input
There is no input for this problem.Output
The first line of output contains integer N – duration of police search in hours. Each of the following N lines contains >exactly 4 integers Xi1, Yi1, Xi2, Yi2 separated by spaces, that represent 2 districts (Xi1, Yi1), (Xi2, Yi2) 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
Sample test(s)
input
В этой задаче нет
This problem doesn’t have sample input and output.
output
Смотрите замечание ниже.Note
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!
小偷每次都要移动,且不能在同一列,警察每次可以找两个地方,那每次找(x,1)和(x,2)(1<=x<=1000),就变成一维的了。再从1找到1000只要小偷在奇数位置就可以找到,然后再从1000找到1只要小偷在偶数位置就可以找到。
#include<iostream>#include<cstdio>using namespace std;int main(void){ int i, j; int n = 1000; printf("%d\n", 2*n); for(i = 1; i <= n; i++) printf("%d %d %d %d\n", i, 1, i, 2); for(i = n; i >= 1; i--) printf("%d %d %d %d\n", i, 1, i, 2); return 0;}
- Bubble Cup 8 - Finals [Online Mirror]
- Codeforces Bubble Cup 8 - Finals [Online Mirror] 解题报告
- Bubble Cup 8 - Finals [Online Mirror]C. Party
- Bubble Cup 9 - Finals [Online Mirror] 题解
- Bubble Cup 8 - Finals [Online Mirror] - A.Fibonotci【分段+ST表】
- Bubble Cup 9 - Finals [Online Mirror] C. Potions Homework (水题)
- 图论+DFS——Bubble Cup 9 - Finals [Online Mirror] E
- VK Cup 2015 - Finals, online mirror
- Codeforce Bubble Cup 8 - Finals D Tablecity
- codeforce Bubble Cup 8 - Finals G Run for beer
- VK Cup 2015 - Finals, online mirror F. Clique in the Divisibility Graph 数论
- VK Cup 2015 - Finals, online mirror D. Restructuring Company 并查集 stl应用
- VK Cup 2015 - Finals, online mirror F - Clique in the Divisibility Graph dp
- Matching Names(Trie树)-(VK Cup 2015 - Finals, online mirror)
- VK Cup 2015 - Finals, online mirror D. Restructuring Company 并查集 set 二分
- Bubble Cup 9 - Finals E. 搜索
- codeforces ABBYY Cup 3.0 - Finals (online version) B2. Shave Beaver!
- [排序不等式] Codeforces 717C Bubble Cup 9 - Finals C. Potions Homework
- Hybrid App开发
- onclick的三种方式
- Android学习——对话框Dialog
- leetcode: (121) Best Time to Buy and Sell Stock
- java中显示类型转换和隐式类型转换
- Bubble Cup 8 - Finals [Online Mirror]
- HelloWorld
- ListView下拉刷新
- 九九乘法表的输出
- hdu 4707 Pet(深搜)
- hdoj 1159 Common Subsequence 【LCS】
- c++构造函数&析构函数
- 2种二分查找及2种优化方式
- 非线性拟合lsqcurvefit、nlinfit