Codeforces #459 A

Written by    13:58 August 16, 2014 

昨天刚回学校, 晚上就和孟海一起打了一场, 结果得了个鸭蛋, 身残志坚, 我还能再战.

Codeforces #459 A

A. Pashmak and Garden
time limit per test

1 second

memory limit per test

256 megabytes

input

standard input

output

standard output

Pashmak has fallen in love with an attractive girl called Parmida since one year ago…

Today, Pashmak set up a meeting with his partner in a romantic garden. Unfortunately, Pashmak has forgotten where the garden is. But he remembers that the garden looks like a square with sides parallel to the coordinate axes. He also remembers that there is exactly one tree on each vertex of the square. Now, Pashmak knows the position of only two of the trees. Help him to find the position of two remaining ones.

Input

The first line contains four space-separated x1, y1, x2, y2 ( - 100 ≤ x1, y1, x2, y2 ≤ 100) integers, where x1 and y1 are coordinates of the first tree and x2 and y2 are coordinates of the second tree. It’s guaranteed that the given points are distinct.

Output

If there is no solution to the problem, print -1. Otherwise print four space-separated integers x3, y3, x4, y4 that correspond to the coordinates of the two other trees. If there are several solutions you can output any of them.

Note that x3, y3, x4, y4 must be in the range ( - 1000 ≤ x3, y3, x4, y4 ≤ 1000).

Sample test(s)
input

output

input

output

input

output

首先贴一个错误代码:

Verdict: Wrong answer on pretest 4

测试数据是

-100 -100 100 100

感觉这个地方应该是自己在在最后一个情况即给出的两点是对角线的时候判断条件有问题, 其实只要任意相邻两边相等即可(因为本来就是矩形).

所以把判断条件改一下即可

Category : acmstudy

Tags :