Problem:


  MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }});

直交判定

平面上の異なる 4 点、$A (x_A, y_A)$, $B (x_B, y_B)$, $C (x_C, y_C)$, $D (x_D, y_D)$ の座標を読み込んで、直線 $AB$ と $CD$ が直交する場合には YES、直交しない場合には NO と出力するプログラムを作成してください。ここで、「直線」とは線分のことではありません。以下の図を参考にして下さい。

Input

複数のデータセットが与えられます。各データセットの形式は以下のとおりです。

$x_A$ $y_A$ $x_B$ $y_B$ $x_C$ $y_C$ $x_D$ $y_D$

$x_A$, $y_A$, $x_B$, $y_B$, $x_C$, $y_C$, $x_D$, $y_D$ はそれぞれ -100 以上 100 以下であり、各値は小数点以下最大 5 桁までの数字を含む実数で与えられます。

データセットの数は 100 を超えません。

Output

各データセットに対して、YES または NO を１行に出力して下さい。

Sample Input

1.0 1.0 2.0 2.0 0.0 0.0 1.0 -1.0
0.0 0.0 2.0 0.0 -1.0 2.0 2.0 2.0
10.0 6.0 3.4 5.2 6.8 9.5 4.3 2.1
2.5 3.5 2.5 4.5 -3.3 -2.3 6.8 -2.3

Output for the Sample Input

YES
NO
NO
YES



Sample input:
1.0 1.0 2.0 2.0 0.0 0.0 1.0 -1.0
0.0 0.0 2.0 0.0 -1.0 2.0 2.0 2.0
10.0 6.0 3.4 5.2 6.8 9.5 4.3 2.1
2.5 3.5 2.5 4.5 -3.3 -2.3 6.8 -2.3


Sample output:
YES
NO
NO
YES

Submission status: Wrong Answer

Solution code:
import sys
for x1, y1, x2, y2, x3, y3, x4, y4 in (map(float, l.split()) for l in sys.stdin.readlines()):
    if (x2-x1)*(x4-x3) + (y4-y3)*(y2-y1) < 1e-9:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
import sys
for x1, y1, x2, y2, x3, y3, x4, y4 in (map(float, l.split()) for l in sys.stdin.readlines()):
    if (x2-x1)*(x4-x3) + (y4-y3)*(y2-y1) == 0:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
import sys
for x1, y1, x2, y2, x3, y3, x4, y4 in (map(float, l.split()) for l in sys.stdin.readlines()):
    if (x2-x1)*(x4-x3) + (y4-y3)*(y2-y1) < 1e-5:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
import sys
for x1, y1, x2, y2, x3, y3, x4, y4 in (map(float, l.split()) for l in sys.stdin.readlines()):
    if (x2-x1)*(x4-x3) + (y4-y3)*(y2-y1) < 1e-10:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
import sys
for x1, y1, x2, y2, x3, y3, x4, y4 in (map(float, l.split()) for l in sys.stdin.readlines()):
    if (x2-x1)*(x4-x3) + (y4-y3)*(y2-y1) < 1e-11:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
while True:
  try:
    xa, ya, xb, yb, xc, yc, xd, yd = map(float, input().split())
    vabx, vaby = xb - xa, yb - ya
    vcdx, vcdy = xd - xc, yd - yc
    print("YES" if abs(vabx * vcdx + vaby * vcdy) == 0 else "NO")
  except EOFError:
    break

Submission status: Wrong Answer

Solution code:
def slant(xa, ya, xb, yb):
    if ya - yb == 0:
        return 'y'
    elif xa - xb == 0:
        return 'x'
    else:
        return (ya - yb) / (xa - xb)

while True:
    try:
        xa, ya, xb, yb, xc, yc, xd, yd = map(float, input().split())
    except:
        break
    AB = slant(xa, ya, xb, yb)
    CD = slant(xc, yc, xd, yd)
    lines = [AB, CD]
    is_digit = 'x' not in lines and 'y' not in lines

    if lines == ['x', 'y'] or lines == ['y', 'x']:
        print('YES')
        continue

    if is_digit:
        print('YES' if AB * CD == -1 else 'NO')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa, ya, xb, yb, xc, yc, xd, yd = map(float, input().split())
    except:
        break
    if (ya - yb) * (yc - yd) + (xb - xa) * (xd - xc) == 0:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa, ya, xb, yb, xc, yc, xd, yd = map(float, input().split())
    except:
        break
    if (ya - yb) * (yc - yd) + (xb - xa) * (xd - xc) == 0.0:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa, ya, xb, yb, xc, yc, xd, yd = map(float, input().split())
    except:
        break
    if (ya - yb) * (yc - yd) + (xa - xb) * (xc - xd) < 1.e-10:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
import sys

for s in sys.stdin:
    xa,ya,xb,yb,xc,yc,xd,yd = map(float,s.split())
    if (xb-xa)*(xd-xc)+(yb-ya)*(yd-yc) == 0: print "YES"
    else: print "NO"

Submission status: Wrong Answer

Solution code:
import sys

for s in sys.stdin:
    err = 0e-4
    xa,ya,xb,yb,xc,yc,xd,yd = map(float,s.split())
    if (xb-xa)*(xd-xc)+(yb-ya)*(yd-yc) <= err: print "YES"
    else: print "NO"

Submission status: Wrong Answer

Solution code:
import sys

for s in sys.stdin:
    xa,ya,xb,yb,xc,yc,xd,yd = map(float,s.split())
    if abs( (xb-xa)*(xd-xc)+(yb-ya)*(yd-yc) )<= 1e-6: print "YES"
    else: print "NO"

Submission status: Wrong Answer

Solution code:
import sys

for s in sys.stdin:
    xa,ya,xb,yb,xc,yc,xd,yd = map(float,s.split())
    if abs( (xb-xa)*(xd-xc)+(yb-ya)*(yd-yc) )<= 0e-10: print "YES"
    else: print "NO"

Submission status: Wrong Answer

Solution code:
import sys

for s in sys.stdin:
    xa,ya,xb,yb,xc,yc,xd,yd = map(float,s.split())
    if abs( (xb-xa)*(xd-xc)+(yb-ya)*(yd-yc) )<= 0.00001: print "YES"
    else: print "NO"

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin

def take2(iterable):
    while True:
        yield next(iterable), next(iterable)
#内積
def dot(v1, v2):
    return v1.real * v2.real + v1.imag * v2.imag

for line in f:
    a,b,c,d = [x + y * 1j for x, y in take2(map(float, line.split()))]
    
    print('YES' if dot(a - b, c - d) == 0 else 'NO')

Submission status: Wrong Answer

Solution code:
import sys
f = sys.stdin


def take2(iterable):
    while True:
        yield next(iterable), next(iterable)
#内積
def dot(v1, v2):
    return v1.real * v2.real + v1.imag * v2.imag

for line in f:
    a,b,c,d = [x + y * 1j for x, y in take2(map(float, line.split()))]
    
    print('YES' if dot(a - b, c - d) <= 0.0001 else 'NO')

Submission status: Wrong Answer

Solution code:
def choco(xa,ya,xb,yb,xc,yc,xd,yd): return 1 if abs((yb-ya)*(yd-yc)+(xb-xa)*(xd-xc))<1 else 0
while 1:
    try:
        xa,ya,xb,yb,xc,yc,xd,yd=map(float,raw_input().split())
        print 'YES' if choco(xa,ya,xb,yb,xc,yc,xd,yd) else 'NO'
    except:
        break

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys


EPS = 10 ** (-12)


def are_orthogonal(a, b, c, d):
    v1 = b - a
    v2 = d - c
    return EPS > abs(v1 * v2.conjugate() + v1.conjugate() * v2)


if __name__ == "__main__":
    for line in sys.stdin:
        xa, ya, xb, yb, xc, yc, xd, yd = map(float, line.split())
        a = complex(xa, ya)
        b = complex(xb, yb)
        c = complex(xc, yc)
        d = complex(xd, yd)
        if are_orthogonal(a, b, c, d):
            print("YES")
        else:
            print("NO")

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys


EPS = 10 ** (-16)


def are_orthogonal(a, b, c, d):
    v1 = b - a
    v2 = d - c
    return EPS > abs(v1 * v2.conjugate() + v1.conjugate() * v2)


if __name__ == "__main__":
    for line in sys.stdin:
        xa, ya, xb, yb, xc, yc, xd, yd = map(float, line.split())
        a = complex(xa, ya)
        b = complex(xb, yb)
        c = complex(xc, yc)
        d = complex(xd, yd)
        if are_orthogonal(a, b, c, d):
            print("YES")
        else:
            print("NO")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

class Point_class():
    def __init__(self, x, y):
        self.x = x
        self.y = y

import sys

for line in sys.stdin:
    A = map(float, line.split())
    p = []
    for i in range(4):
        p.append(Point_class(A[2*i], A[2*i+1]))
    if (p[3].y-p[2].y)*(p[1].y-p[0].y) == -(p[3].x-p[2].x)*(p[1].x-p[0].x):
        print "YES"
    else:
        print "NO"

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a = []
        a = list(map(float, input().split()))
        if (a[2] - a[0] == 0 and a[7] - a[5] == 0)\
            or (a[3] - a[1] == 0 and a[6] - a[4] == 0):
            print("YES")
        elif (a[2] - a[0] == 0 and a[7] - a[5] != 0)\
            or (a[3] - a[1] != 0 and a[6] - a[4] == 0):
            print("NO")
        else:
            b = (a[3] - a[1]) / (a[2] - a[0])
            c = (a[7] - a[5]) / (a[6] - a[4])
            if b * c == -1:
                print("YES")
            else:
                print('NO')
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a = []
        a = list(map(float, input().split()))
        if (a[2] - a[0] == 0 and a[7] - a[5] == 0)\
            or (a[3] - a[1] == 0 and a[6] - a[4] == 0):
            print("YES")
        elif (a[2] - a[0] == 0 and a[7] - a[5] != 0)\
            or (a[3] - a[1] != 0 and a[6] - a[4] == 0):
            print("NO")
        else:
            b = (a[3] - a[1]) / (a[2] - a[0])
            c = (a[7] - a[5]) / (a[6] - a[4])
            if b * c == -1:
                print("YES")
            else:
                print('NO')
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
import sys

for line in sys.stdin:
  ax,ay,bx,by,cx,cy,dx,dy = list(map(float,line.split()))
  dx1 = bx - ax
  dy1 = by - ay
  dx2 = dx - cx
  dy2 = dy - cy
  x = dx1 * dx2
  y = dy1 * dy2
  if x + y == 0:
    print("YES")
  else:
    print("NO")

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa,ya,xb,yb,xc,yc,xd,yd = map(float,input().split())
        ya_b = ya - yb
        xa_b = xa - xb
        yc_d = yc - yd
        xc_d = xc - xd
        if ya_b == 0 and xa_b == 0:
            print("NO")
        elif yc_d == 0 and xc_d == 0:
            print("NO")
        elif ya_b == 0 and xc_d ==0:
            print("YES")
        elif yc_d == 0 and xa_b ==0:
            print("YES")
        elif ya_b * yc_d == -(xc_d * xa_b):
            print("YES")
        else:
            print("NO")
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa,ya,xb,yb,xc,yc,xd,yd = map(float,input().split())
        ya_b = ya - yb
        xa_b = xa - xb
        yc_d = yc - yd
        xc_d = xc - xd
        if ya_b == 0 and xa_b == 0:
            print("NO")
        elif yc_d == 0 and xc_d == 0:
            print("NO")
        elif ya_b == 0 and xc_d ==0:
            print("YES")
        elif yc_d == 0 and xa_b ==0:
            print("YES")
        elif (ya_b * yc_d) +(xc_d * xa_b) == 0:
            print("YES")
        else:
            print("NO")
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa,ya,xb,yb,xc,yc,xd,yd = map(float,input().split())
        ya_b = ya - yb
        xa_b = xa - xb
        yc_d = yc - yd
        xc_d = xc - xd
        if (ya_b * yc_d) +(xc_d * xa_b) == 0:
            print("YES")
        else:
            print("NO")
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
def dot(u,v):
    return(u[0]*v[0] + u[1]*v[1])

def solve(v):
    eps = 1e-5
    xa,ya,xb,yb,xc,yc,xd,yd = v
    if abs(dot( (xb-xa, yb-ya), (xd-xc, yd-yc)) ) < eps:
        return(True)
    else:
        return(False)

while True:
    try:
        v = map(float, input().strip().split())
        if solve(v):
            print("YES")
        else:
            print("NO")
    except EOFError:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        x1,y1,x2,y2,x3,y3,x4,y4 = map(float,input().split())
    except EOFError:
        break
    if x1 == x2:
        if y3 == y4:
            print('YES')
        continue
    elif x3 == x4:
        if y1 == y2:
            print('YES')
        continue
    p = (y2 - y1) / (x2 - x1)
    q = (y4 - y3) / (x4 - x3)
    EPS = 1e-9
    if -1.0 - EPS <= p * q <= -1.0 + EPS:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
import os

for s in sys.stdin:
    ax, ay, bx, by, cx, cy, dx, dy = map(float, s.split())

    AB = (bx - ax, by - ay)
    CD = (dx - cx, dy - cy)

    cross = AB[0] * CD[0] + AB[1] * CD[1]

    if cross == 0:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0021&lang=jp
WA
"""
import sys
from sys import stdin
input = stdin.readline



class Point(object):
    epsilon = 1e-10

    def __init__(self, x=0.0, y=0.0):
        if isinstance(x, tuple):
            self.x = x[0]
            self.y = x[1]
        else:
            self.x = x
            self.y = y

    # ????????????
    def __add__(self, other):
        return Point(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return Point(self.x - other.x, self.y - other.y)

    def __mul__(self, other):
        return Point(other * self.x, other * self.y)

    def __truediv__(self, other):
        return Point(self.x / other, self.y / other)

    def __lt__(self, other):
        if self.x == other.x:
            return self.y < other.y
        else:
            return self.x < other.x

    def __eq__(self, other):
        from math import fabs
        if fabs(self.x - other.x) < Point.epsilon and fabs(self.y - other.y) < Point.epsilon:
            return True
        else:
            return False

    def norm(self):
        return self.x * self.x + self.y * self.y

    def __abs__(self):
        return sqrt(self.norm())

    def ccw(self, p0, p1):
        # ??????2???(p0, p1)?????????????????????????????????????????¢????????????
        a = Vector(p1 - p0)
        b = Vector(self - p0)
        if Vector.cross(a, b) > Point.epsilon:
            return 1 # 'COUNTER_CLOCKWISE'
        elif Vector.cross(a, b) < -Point.epsilon:
            return -1 # 'CLOCKWISE'
        elif Vector.dot(a, b) < -Point.epsilon:
            return 2 # 'ONLINE_BACK'
        elif a.norm() < b.norm():
            return -2 # 'ONLINE_FRONT'
        else:
            return 0 # 'ON_SEGMENT'

    def project(self, s):
        # ??????(Point)????????????s??????????????????????????????????????§?¨?(?°???±)????±???????
        base = Vector(s.p2 - s.p1)
        a = Vector(self - s.p1)
        r = Vector.dot(a, base)
        r /= base.norm()
        return s.p1 + base * r

    def reflect(self, s):
        # ??????s???????§°?????¨?????????????????¨???????§°??????????????§?¨?(????°?)????±???????
        proj = self.project(s)
        return self + (proj - self)*2

    def distance(self, s):
        # ????????¨??????s????????¢????¨??????????
        if Vector.dot(s.p2-s.p1, self-s.p1) < 0.0:
            return abs(self - s.p1)
        if Vector.dot(s.p1-s.p2, self-s.p2) < 0.0:
            return abs(self - s.p2)
        return abs(Vector.cross(s.p2-s.p1, self-s.p1) / abs(s.p2-s.p1))


class Vector(Point):
    def __init__(self, x=0.0, y=0.0):
        if isinstance(x, tuple):
            self.x = x[0]
            self.y = x[1]
        elif isinstance(x, Point):
            self.x = x.x
            self.y = x.y
        else:
            self.x = x
            self.y = y

    # ????????????
    def __add__(self, other):
        return Vector(self.x + other.x, self.y + other.y)

    def __sub__(self, other):
        return Vector(self.x - other.x, self.y - other.y)

    def __mul__(self, other):
        return Vector(other * self.x, other * self.y)

    def __truediv__(self, other):
        return Vector(self.x / other, self.y / other)


    @classmethod
    def dot(cls, a, b):
        return a.x * b.x + a.y * b.y

    @classmethod
    def cross(cls, a, b):
        return a.x * b.y - a.y * b.x

    @classmethod
    def is_orthogonal(cls, a, b):
        return Vector.dot(a, b) == 0.0

    @classmethod
    def is_parallel(cls, a, b):
        return Vector.cross(a, b) == 0.0


class Segment(object):
    def __init__(self, p1=Point(), p2=Point()):
        if isinstance(p1, Point):
            self.p1 = p1
            self.p2 = p2
        elif isinstance(p1, tuple):
            self.p1 = Point(p1[0], p1[1])
            self.p2 = Point(p2[0], p2[1])

    def intersect(self, s):
        # ????????¨??????????????????????????????????????????????????????
        ans1 = s.p1.ccw(self.p1, self.p2) * s.p2.ccw(self.p1, self.p2)
        ans2 = self.p1.ccw(s.p1, s.p2) * self.p2.ccw(s.p1, s.p2)
        return ans1 <= 0 and ans2 <= 0

    def cross_point(self, s):
        # ????????¨??????????????????????????????????????§?¨?????±???????
        base = s.p2 - s.p1
        d1 = abs(Vector.cross(base, self.p1-s.p1))
        d2 = abs(Vector.cross(base, self.p2-s.p1))
        t = d1 / (d1 + d2)
        return self.p1 + (self.p2 - self.p1) * t

    def distance(self, s):
        # ????????¨?????????????????????????????¢????±???????
        if self.intersect(s):
            return 0.0
        d1 = s.p1.distance(self)
        d2 = s.p2.distance(self)
        d3 = self.p1.distance(s)
        d4 = self.p2.distance(s)
        return min(d1, d2, d3, d4)


    @classmethod
    def is_orthogonal(cls, s1, s2):
        a = Vector(s1.p2 - s1.p1)
        b = Vector(s2.p2 - s2.p1)
        return Vector.is_orthogonal(a, b)

    @classmethod
    def is_parallel(cls, s1, s2):
        a = Vector(s1.p2 - s1.p1)
        b = Vector(s2.p2 - s2.p1)
        return Vector.is_parallel(a, b)


class Line(Segment):
    pass


class Cirle(object):
    def __init__(self, x, y=Point(), r=1.0):
        if isinstance(x, Point):
            self.c = x
            self.r = y
        elif isinstance(x, tuple):
            self.c = Point(x[0], x[1])
            self.r = r

    def cross_points(self, s):
        if isinstance(s, Segment):
            pr = self.c.project(s)
            e = (s.p2 - s.p1) / abs(s.p2 - s.p1)
            base = sqrt(self.r * self.r - (pr - self.c).norm())
            return pr + e * base, pr - e * base
        elif isinstance(s, Cirle):
            c2 = s
            d = abs(self.c - c2.c)
            a = acos((self.r * self.r + d * d - c2.r * c2.r) / (2 * self.r * d))
            t = atan2(c2.c.y - self.c.y, c2.c.x - self.c.x)
            temp1 = Point(cos(t+a)*self.r, sin(t+a)*self.r)
            temp2 = Point(cos(t-a)*self.r, sin(t-a)*self.r)
            return self.c + temp1, self.c + temp2


def contains(polygon, p):
    n = len(polygon)
    x = False
    for i in range(n):
        a = polygon[i] - p
        b = polygon[(i+1)%n] - p
        if abs(Vector.cross(a, b)) < Point.epsilon and Vector.dot(a, b) < Point.epsilon:
            return 1
        if a.y > b.y:
            temp = a
            a = b
            b = temp
        if a.y < Point.epsilon and Point.epsilon < b.y and Vector.cross(a, b) > Point.epsilon:
            x = not x
    return 2 if x else 0


def main(args):
        for line in sys.stdin:
            x1, y1, x2, y2, x3, y3, x4, y4 = map(float, line.split())
            a = Point(x1, y1)
            b = Point(x2, y2)
            c = Point(x3, y3)
            d = Point(x4, y4)
            AB = Segment(a, b)
            CD = Segment(c, d)
            result = Segment.is_orthogonal(AB, CD)
            if result:
                print('YES')
            else:
                print('NO')


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Wrong Answer

Solution code:
while True:
    try:
        x_a, y_a, x_b, y_b, x_c, y_c, x_d, y_d = map(float, input().split(","))
        ab_x, ab_y = x_b - x_a, y_b - y_a
        cd_x, cd_y = x_d - x_c, y_d - y_c
        dp = ab_x*cd_x + ab_y*cd_y
        if dp:
            print("NO")
        else:
            print("YES")
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        x_a, y_a, x_b, y_b, x_c, y_c, x_d, y_d = map(float, input().split())
        ab_x, ab_y = x_b - x_a, y_b - y_a
        cd_x, cd_y = x_d - x_c, y_d - y_c
        dp = ab_x*cd_x + ab_y*cd_y
        if dp:
            print("NO")
        else:
            print("YES")
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        x_a, y_a, x_b, y_b, x_c, y_c, x_d, y_d = map(float, input().split())
        ab_x, ab_y = x_b - x_a, y_b - y_a
        cd_x, cd_y = x_d - x_c, y_d - y_c
        dp = ab_x*cd_x + ab_y*cd_y
        if dp == 0:
            print("YES")
        else:
            print("NO")
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        x_a, y_a, x_b, y_b, x_c, y_c, x_d, y_d = map(float, input().split())
        ab_x, ab_y = x_b - x_a, y_b - y_a
        cd_x, cd_y = x_d - x_c, y_d - y_c
        dp = ab_x*cd_x + ab_y*cd_y
        if dp:
            print("NO")
        elif (ab_x == 0 and ab_y == 0) or (cd_x == 0 and cd_y == 0):
            print("NO")
        else:
            print("YES")
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        x_a, y_a, x_b, y_b, x_c, y_c, x_d, y_d = map(float, input().split())
        ab_x, ab_y = x_b - x_a, y_b - y_a
        cd_x, cd_y = x_d - x_c, y_d - y_c
        dp = ab_x*cd_x + ab_y*cd_y
        if dp > 1e-10:
            print("NO")
        else:
            print("YES")
    except:
        break

Submission status: Wrong Answer

Solution code:
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

N = list(get_input())
for l in range(len(N)):
    P = [float(i) for i in N[l].split()]
    AB = [P[2]-P[0],P[3]-P[1]]
    CD = [P[6]-P[4],P[7]-P[5]]
    if AB[0]*CD[0] + AB[1]*CD[1] == 0:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
import sys
for x in sys.stdin:
 a,b,c,d,e,f,g,h=map(float,x.split())
 print(['NO','YES'][(a-c)*(e-g)+(b-d)*(f-h)==0])

Submission status: Wrong Answer

Solution code:
import sys
for x in sys.stdin:
 a,b,c,d,e,f,g,h=map(float,x.split());z=1e-9
 print(['NO','YES'][-z<(a-c)*(e-g)+(b-d)*(f-h)<z])

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa,ya,xb,yb,xc,yc,xd,yd=map(float,input().split())
    except EOFError:
        break
    if (ya-yb)*(yc-yd)+(xa-xb)*(xc-xd)<0.00001:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa,ya,xb,yb,xc,yc,xd,yd=map(float,input().split())
    except EOFError:
        break
    if (ya-yb)*(yc-yd)+(xa-xb)*(xc-xd)<1e-10:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xa,ya,xb,yb,xc,yc,xd,yd=map(float,input().split())
    except EOFError:
        break
    if (ya-yb)*(yc-yd)+(xa-xb)*(xc-xd)<=1e-10:
        print("YES")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
import sys
orth=lambda l:((l[2]-l[0])*(l[6]-l[4])+(l[3]-l[1])*(l[7]-l[5]))
[print(l) for l in ["YES" if orth(j)==0 else "NO" for j in [list(map(float,l.split())) for l in sys.stdin]]]

Submission status: Wrong Answer

Solution code:

import sys


class Line:
    def __init__(self, xa, ya, xb, yb):
        if xa == xb:
            self.slope = None
        elif ya == yb:
            self.slope = 0.0
        else:
            self.slope = (yb - ya) / (xb - xa)

    def orthogonal(self, other):
        if self.slope == None:
            if other.slope == 0:
                return 'YES'
            else:
                return 'NO'
        elif self.slope == 0:
            if other.slope == None:
                return 'YES'
            else:
                return 'NO'
        else:
            if self.slope * other.slope == -1.0:
                return 'YES'
            else:
                return 'NO'



for line in sys.stdin:
    xa, ya, xb, yb, xc, yc, xd, yd = tuple(map(float, line.split(' ')))
    line_a = Line(xa, ya, xb, yb)
    line_b = Line(xc, yc, xd, yd)
    print line_a.orthogonal(line_b)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

for line in stdin:
    ax, ay, bx, by, cx, cy, dx, dy = (float(s) for s in line.split())

    if (ax - bx) * (cx - dx) + (ay - by) * (cy - dy) == 0.0:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

for line in stdin:
    ax, ay, bx, by, cx, cy, dx, dy = (float(s) for s in line.split())

    tx, ty = (ax - bx, ay - by)
    sx, sy = (cx - dx, cy - dy)

    try:
        m = ty / tx
    except ZeroDivisionError:
        m = float('inf')
    try:
        n = sy / sx
    except ZeroDivisionError:
        n = float('inf')

    if m == n:
        print('NO')
    elif tx * sx + ty * sy != 0.0:
        print('NO')
    else:
        print('YES')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

for line in stdin:
    ax, ay, bx, by, cx, cy, dx, dy = (float(s) for s in line.split())

    tx, ty = (ax - bx, ay - by)
    sx, sy = (cx - dx, cy - dy)

    if tx * sy - ty * sx == 0.00000:
        print('NO')
    elif tx * sx + ty * sy == 0.00000:
        print('YES')
    else:
        print('NO')

Submission status: Wrong Answer

Solution code:
import sys
for s in sys.stdin:
    a,b,c,d,e,f,g,h=map(float,s.split())
    if abs((c-a)*(g-e)+(d-b)*(h-f))<1e-6:m="YES"
    else:m="NO"
    print m

Submission status: Wrong Answer

Solution code:
import sys
for s in sys.stdin:
    a,b,c,d,e,f,g,h=map(float,s.split())
    if (c-a)*(g-e)+(d-b)*(h-f)==0:m="YES"
    else:m="NO"
    print m

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) < 1.e-10:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) < 1.e-12:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 0.1:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 0:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 10:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 100:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 1000:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 1.e-5:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 1.e-10:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float,raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 1.e-10:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (100000*(yB-yA))*(100000*(yD-yC)) + (100000*(xB-xA))*(100000*(xD-xC)) < 10.0:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if(yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) == 0:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if(yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) + 0 == 0:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) + 0 == 0:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) + 0 == 0.0:
            print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) == 0.0:
            if yB-yA != 0 or xD-xC != 0:
                print "YES"
            else:
                print "NO"
        else:
            print "NO"
    except:
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        xA,yA,xB,yB,xC,yC,xD,yD = map(float, raw_input().split())
        if (yB-yA)*(yD-yC) + (xB-xA)*(xD-xC) == 0.0:
                print "YES"
        else:
            print "NO"
    except:
        break

Submission status: Accepted

Solution code:
import sys
for x1, y1, x2, y2, x3, y3, x4, y4 in (map(lambda x: int(float(x)*100000), l.split()) for l in sys.stdin.readlines()):
    if (x2-x1)*(x4-x3) + (y4-y3)*(y2-y1) == 0:
        print("YES")
    else:
        print("NO")

Submission status: Accepted

Solution code:
import sys
from fractions import Fraction
for x1, y1, x2, y2, x3, y3, x4, y4 in (map(Fraction, l.split()) for l in sys.stdin.readlines()):
    if (x2-x1)*(x4-x3) + (y4-y3)*(y2-y1) == 0:
        print("YES")
    else:
        print("NO")

Submission status: Accepted

Solution code:
E = 10 ** -10
while True:
  try:
    xa, ya, xb, yb, xc, yc, xd, yd = map(float, input().split())
    vabx, vaby = xb - xa, yb - ya
    vcdx, vcdy = xd - xc, yd - yc
    print("YES" if abs(vabx * vcdx + vaby * vcdy) < E else "NO")
  except EOFError:
    break