영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)
Problem
You have been captured by an evil giant. You are both in a N × M big cave consisting of all points with integer coordinates (x, y) such that 0 ≤ x < N, 0 ≤ y < M. The giant plans to eat you, so you must escape before it's too late! The giant is standing with his feet at two different points in the cave. To escape, you plan to put a bar of gold at a third point in the cave. The giant will then bend down to pick the bar up. If the positions for the giant's feet and the gold bar together form an obtuse triangle, the giant will lose his balance and fall down. In this case, you will get an opportunity to run.
Write a program that, given the size of the cave, the coordinates for the giant's right foot (x_1, y_1) and the coordinates for the giant's left foot (x_2, y_2), finds a point with integer coordinates at which to place the bar of gold, so that the three points form a non-degenerate (A triangle is non-degenerate if its three vertices do not lie on the same line, https://en.wikipedia.org/wiki/Degeneracy_(mathematics)) obtuse triangle.
Input
The first line of the input contains two integers N and M (1 ≤ N, M ≤ 10^9), the size of the cave.
The second line contains four integers x_1, y_1, x_2 and y_2 (0 ≤ x_1, x_2 < N, 0 ≤ y_1, y_2 < M), the coordinates for the giant's two feets. These points will always be different.
Output
Print two integers x_3, y_3 (0 ≤ x_3 < N, 0 ≤ y_3 < M) on the same line, so that the point with these coordinates together with the two points in the input forms a non-degenerate obtuse triangle. The input is constructed so that there is always at least one such point.
Scoring
Your solution will be tested on a set of test case groups. To get the points for a group, you need to pass all the test cases in the group.
| Group | Points | Constraints |
| 1 | 30 | 1 ≤ N ≤ 1000 and 1 ≤ M ≤ 1000 |
| 2 | 25 | 1000 ≤ N ≤ 10^9 and 1000 ≤ M ≤ 10^9 |
| 3 | 15 | x_1 ≠ x_2 and y_1 ≠ y_2 |
| 4 | 30 | No further constraints |
Explanation of sample 1
In example 1, the points (1,1), (3,4) and (1,2) form an obtuse triangle, with the obtuse angle at (1,2). (1,2) is also within the cave.
The point (1,4) would not have been a correct answer, since that would form a right triangle rather than an obtuse triangle.
The point (5,7) would not have been a correct answer, since that would form a degenerate triangle, and (5,7) is also placed outside of the cave.
예제
예제 1
4 5 1 1 3 4
1 2
예제 2
1000 1000 500 500 500 502
499 499
예제 3
1000000000 1000000000 0 0 0 999999999
1 999999998