CF1537B.Bad Boy
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Riley is a very bad boy, but at the same time, he is a yo-yo master. So, he decided to use his yo-yo skills to annoy his friend Anton.
Anton's room can be represented as a grid with n rows and m columns. Let (i,j) denote the cell in row i and column j. Anton is currently standing at position (i,j) in his room. To annoy Anton, Riley decided to throw exactly two yo-yos in cells of the room (they can be in the same cell).
Because Anton doesn't like yo-yos thrown on the floor, he has to pick up both of them and return back to the initial position. The distance travelled by Anton is the shortest path that goes through the positions of both yo-yos and returns back to (i,j) by travelling only to adjacent by side cells. That is, if he is in cell (x,y) then he can travel to the cells (x+1,y), (x−1,y), (x,y+1) and (x,y−1) in one step (if a cell with those coordinates exists).
Riley is wondering where he should throw these two yo-yos so that the distance travelled by Anton is maximized. But because he is very busy, he asked you to tell him.
莱利是个非常淘气的男孩,但同时他又是一位溜溜球高手。因此,他决定利用自己的溜溜球技巧来捉弄他的朋友安东。
安东的房间可以表示为一个 n 行 m 列的网格。记 (i,j) 表示第 i 行、第 j 列的格子。安东当前正站在房间中的位置 (i,j)。为了捉弄安东,莱利决定在房间的格子中恰好投掷两个溜溜球(这两个溜溜球可以落在同一个格子中)。
由于安东不喜欢地板上的溜溜球,他必须捡起这两个溜溜球,并返回到初始位置 (i,j)。安东所走的路程,是仅通过上下左右相邻(即共享一条边)的格子、且路径经过两个溜溜球所在位置并最终回到 (i,j) 的最短路径长度。也就是说,若他当前位于格子 (x,y),则他每一步可移动至格子 (x+1,y)、(x−1,y)、(x,y+1) 或 (x,y−1)(前提是该坐标对应的格子存在)。
莱利想知道:他应将这两个溜溜球投掷在哪些位置,才能使安东所走的路程最大化?但由于他实在太忙,他请你来帮他解答这个问题。
输入格式
The first line contains a single integer t (1≤t≤104) — the number of test cases. Then t test cases follow.
The only line of each test case contains four integers n, m, i, j (1≤n,m≤109, 1≤i≤n, 1≤j≤m) — the dimensions of the room, and the cell at which Anton is currently standing.
第一行包含一个整数 t(1≤t≤104),表示测试用例的数量。随后是 t 个测试用例。
每个测试用例仅有一行,包含四个整数 n、m、i、j(1≤n,m≤109,1≤i≤n,1≤j≤m),分别表示房间的尺寸以及 Anton 当前所处的格子位置。
输出格式
For each test case, print four integers x1, y1, x2, y2 (1≤x1,x2≤n, 1≤y1,y2≤m) — the coordinates of where the two yo-yos should be thrown. They will be thrown at coordinates (x1,y1) and (x2,y2).
If there are multiple answers, you may print any.
对于每个测试用例,输出四个整数 x1、y1、x2、y2(满足 1≤x1,x2≤n,1≤y1,y2≤m)——即两个溜溜球应被抛出的位置坐标。它们将被分别抛向坐标 (x1,y1) 和 (x2,y2)。
若存在多个合法答案,输出任意一个即可。
输入输出样例
输入#1
7 2 3 1 1 4 4 1 2 3 5 2 2 5 1 2 1 3 1 3 1 1 1 1 1 1000000000 1000000000 1000000000 50
输出#1
1 2 2 3 4 1 4 4 3 1 1 5 5 1 1 1 1 1 2 1 1 1 1 1 50 1 1 1000000000
说明/提示
Here is a visualization of the first test case.

以下是第一个测试用例的可视化图示。

输入解题思路,AI测评打分。不知道怎么写?