102460: [AtCoder]ABC246 A - Four Points

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $100$ points

Problem Statement

There is a rectangle in the $xy$-plane. Each edge of this rectangle is parallel to the $x$- or $y$-axis, and its area is not zero.

Given the coordinates of three of the four vertices of this rectangle, $(x_1, y_1)$, $(x_2, y_2)$, and $(x_3, y_3)$, find the coordinates of the other vertex.

Constraints

  • $-100 \leq x_i, y_i \leq 100$
  • There uniquely exists a rectangle with all of $(x_1, y_1)$, $(x_2, y_2)$, $(x_3, y_3)$ as vertices, edges parallel to the $x$- or $y$-axis, and a non-zero area.
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

$x_1$ $y_1$
$x_2$ $y_2$
$x_3$ $y_3$

Output

Print the sought coordinates $(x, y)$ separated by a space in the following format:

$x$ $y$

Sample Input 1

-1 -1
-1 2
3 2

Sample Output 1

3 -1

The other vertex of the rectangle with vertices $(-1, -1), (-1, 2), (3, 2)$ is $(3, -1)$.


Sample Input 2

-60 -40
-60 -80
-20 -80

Sample Output 2

-20 -40

Input

题意翻译

给定四条边均平行于坐标轴的矩形三个点的坐标,求另一个点的坐标。

Output

分数:100分

问题描述

在$xy$平面上有一个矩形。这个矩形的每条边都与$x$轴或$y$轴平行,且面积不为零。

给定这个矩形四个顶点中的三个顶点的坐标$(x_1, y_1)$、$(x_2, y_2)$和$(x_3, y_3)$,找出第四个顶点的坐标。

限制条件

  • $-100 \leq x_i, y_i \leq 100$
  • 存在一个矩形,其所有顶点为$(x_1, y_1)$、$(x_2, y_2)$、$(x_3, y_3)$,边与$x$轴或$y$轴平行,面积非零,并且是唯一的。
  • 输入中的所有值都是整数。

输入

从标准输入按以下格式获取输入:

$x_1$ $y_1$
$x_2$ $y_2$
$x_3$ $y_3$

输出

按以下格式打印目标坐标$(x, y)$,用空格分隔:

$x$ $y$

样例输入1

-1 -1
-1 2
3 2

样例输出1

3 -1

长方形的顶点为$(-1, -1), (-1, 2), (3, 2)$的另一个顶点为$(3, -1)$。


样例输入2

-60 -40
-60 -80
-20 -80

样例输出2

-20 -40

加入题单

算法标签: