SAC '22 Code Challenge 3 Junior P2 - Normal Lines

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 1.0s
Memory limit: 256M

Authors:
Problem type

Leo Zhuang, who just graduated elementary school, is working hard as always. This time, he has encountered a graphing problem:

Given a line segment from (x_1, y_1) to (x_2, y_2), determine if the segment is parallel to either the x-axis or the y-axis.

If it is parallel to the x-axis, output x-axis; if it is parallel to the y-axis, output y-axis; if it is parallel to neither axis, output neither.

Can you determine this for him?

Constraints

-10^9 \le x_1, y_1, x_2, y_2 \le 10^9

Note that the coordinates of the points will not be identical.

Input Specification

The first line will contain the integer coordinates of the first point, x_1 and y_1, respectively.

The second line will contain the integer coordinates of the second point, x_2 and y_2, respectively.

Output Specification

Answer Leo's question: if it is parallel to the x-axis, output x-axis; if it is parallel to the y-axis, output y-axis; if it is parallel to neither axis, output neither.

Sample Input 1

7 -2
-3 -2

Sample Output 1

x-axis

Sample Input 2

-5 5
-5 10

Sample Output 2

y-axis

Sample Input 3

3 3
-3 -3

Sample Output 3

neither

Comments

There are no comments at the moment.