s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
int64
0
100
memory
stringlengths
4
6
code_size
int64
15
14.7k
code
stringlengths
15
14.7k
problem_id
stringlengths
6
6
problem_description
stringlengths
358
9.83k
input
stringlengths
2
4.87k
output
stringclasses
807 values
__index_level_0__
int64
1.1k
1.22M
s931491564
p00020
u406093358
1555487156
Python
Python
py
Accepted
10
4632
189
def capitalize(c): return chr(ord(c)-32) s = raw_input() ans = '' for i in range(0, len(s)): if s[i] == '.' or s[i] == ' ': ans = ans + s[i] else: ans = ans + capitalize(s[i]) print ans
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,302
s968938895
p00020
u350155409
1553219300
Python
Python3
py
Accepted
20
5532
29
s = input() print(s.upper())
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,303
s785422141
p00020
u689047545
1547136198
Python
Python3
py
Accepted
20
5536
29
s = input() print(s.upper())
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,304
s165507807
p00020
u563075864
1542685903
Python
Python3
py
Accepted
40
6676
138
from string import ascii_lowercase text = input() cap = [chr(ord(i)-32) if i in ascii_lowercase else i for i in text] print("".join(cap))
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,305
s767190462
p00020
u067299340
1542173400
Python
Python3
py
Accepted
20
5536
23
print(input().upper())
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,306
s300091049
p00020
u717526540
1541651946
Python
Python3
py
Accepted
20
5532
38
s = input() s = s.upper() print(s)
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,307
s543454650
p00020
u219940997
1537452782
Python
Python3
py
Accepted
20
5532
26
print(input().swapcase())
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,308
s701062857
p00020
u536280367
1537020495
Python
Python3
py
Accepted
20
5536
24
print(input().upper())
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,309
s412085672
p00020
u252700163
1534609008
Python
Python3
py
Accepted
20
5532
37
s = input() s = s.upper() print(s)
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,310
s663955876
p00020
u319725914
1534226509
Python
Python3
py
Accepted
20
5536
23
print(input().upper())
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,311
s230233958
p00020
u995990363
1533791926
Python
Python3
py
Accepted
20
5616
114
import math def run(): text = input().strip() print(text.upper()) if __name__ == '__main__': run()
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,312
s338319973
p00020
u539753516
1533385200
Python
Python3
py
Accepted
20
5536
23
print(input().upper())
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,313
s584263780
p00020
u079141094
1467422954
Python
Python3
py
Accepted
30
7312
36
# Capitalize print(input().upper())
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,314
s047793517
p00020
u197615660
1374671672
Python
Python
py
Accepted
10
4192
36
str = raw_input() print str.upper()
p00020
<H1>Capitalize</H1> <p> Write a program which replace all the lower-case letters of a given text with the corresponding captital letters. </p> <H2>Input</H2> <p> A text including lower-case letters, periods, and space is given in a line. The number of characters in the text is less than or equal to 200. </p> <H2>Output</H2> <p> Print the converted text. </p> <H2>Sample Input</H2> <pre> this is a pen. </pre> <H2>Output for the Sample Input</H2> <pre> THIS IS A PEN. </pre>
this is a pen.
THIS IS A PEN.
7,315
s531181563
p00021
u352394527
1530880591
Python
Python3
py
Accepted
20
5636
335
E = 10 ** -10 def check(lst): x1, y1, x2, y2, x3, y3, x4, y4 = lst vabx, vaby = x2 - x1, y2 - y1 vcdx, vcdy = x4 - x3, y4 - y3 if abs(vabx * vcdy - vcdx * vaby) < E: return True else: return False n = int(input()) for _ in range(n): plst = list(map(float, input().split())) print("YES" if check(plst) else "NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,316
s663715146
p00021
u990228206
1551339634
Python
Python3
py
Accepted
20
5632
348
n=int(input()) for nn in range(n): x1,y1,x2,y2,x3,y3,x4,y4=list(map(float,input().split())) if x2-x1==0 or x4-x3==0: if x1==x2 and x3==x4: print("YES") else: print("NO") else: if abs((y2-y1)/(x2-x1)-(y4-y3)/(x4-x3))<10**-10: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,317
s003229306
p00021
u198069342
1407222677
Python
Python3
py
Accepted
30
6748
185
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) print('YES' if abs((x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1)) < 1e-10 else 'NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,318
s846951046
p00021
u193025715
1408969897
Python
Python3
py
Accepted
30
6744
213
for i in range(int(input())): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) if abs((y1 - y2) * (x3 - x4) - (y3 - y4) * (x1 - x2)) < 1.e-10: print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,319
s815510395
p00021
u385497113
1409339512
Python
Python
py
Accepted
10
4372
310
#! -*- coding: utf-8-unix -*- import math if __name__=='__main__': n = int(raw_input()) for i in xrange(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' ')) if math.fabs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < 1e-10: print 'YES' else: print 'NO'
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,320
s011866832
p00021
u385497113
1409339553
Python
Python
py
Accepted
10
4368
1,083
#! -*- coding: utf-8-unix -*- import math if __name__=='__main__': # lines = [x.strip() for x in sys.stdin.readlines() if x != '' and x != '\n'] # n = int(lines[0]) n = int(raw_input()) for i in xrange(n): # x1, y1, x2, y2, x3, y3, x4, y4 = map(float, lines[i+1].split(' ')) x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().strip().split(' ')) # if x1 == x2 or x3 == x4: # if x1 == x2 and x3 == x4: # print 'YES' # else: # print 'NO' # continue # elif y1 == y2 or y3 == y4: # if y1 == y2 and y3 == y4: # print 'YES' # else: # print 'NO' # continue # else: # if (y2 - y1) * (x4 - x3) == (y4 - y3) * (x2 - x1): if math.fabs((y2 - y1) * (x4 - x3) - (y4 - y3) * (x2 - x1)) < 1e-10: print 'YES' else: print 'NO' # a1 = (y2 - y1) / (x2 - x1) # b1 = y1 - a1 * x1 # a2 = (y4 - y3) / (x4 - x3) # b2 = y3 - a2 * x3 # if (a1 == a2):# and (b1 != b2): # print 'YES' # else: # print 'NO' # except: # break
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,321
s030952324
p00021
u244742296
1409926153
Python
Python3
py
Accepted
30
6800
1,137
class Point(object): def __init__(self, x, y): self.x = x self.y = y def __str__(self): return "x = {0}, y = {1}".format(self.x, self.y) class Line(Point): eps = 10**(-10) def __init__(self, p1, p2): self.p1 = p1 self.p2 = p2 def isParallel(self, another_p): try: angle1 = (self.p1.y - self.p2.y) / (self.p1.x - self.p2.x) angle2 = (another_p.p1.y - another_p.p2.y) / (another_p.p1.x - another_p.p2.x) if angle1 >= angle2-self.eps and angle1 <= angle2+self.eps: return True else: return False except ZeroDivisionError: if self.p1.x == self.p2.x and another_p.p1.x == another_p.p2.x: return True else: return False n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) A = Point(x1, y1) B = Point(x2, y2) C = Point(x3, y3) D = Point(x4, y4) AB = Line(A, B) CD = Line(C, D) if AB.isParallel(CD): print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,322
s844645393
p00021
u615353970
1411038794
Python
Python
py
Accepted
20
4228
180
n = int(raw_input()) for l in range(n): x1,y1,x2,y2,x3,y3,x4,y4 = map(float,raw_input().split()) if abs((y4-y3)*(x2-x1)-(y2-y1)*(x4-x3))< 1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,323
s023488041
p00021
u696166817
1416058917
Python
Python3
py
Accepted
30
6748
558
# Edit: 2014/11/15 # Lang: Python3 # Time: 00.xxs # File: pc0021.py if __name__ == "__main__": nset = int(input()) for i in range(0, nset): x1, y1, x2, y2, x3, y3, x4, y4 = list(map(float, input().strip("\n").split(" "))) vABx = x2 - x1 vABy = y2 - y1 vCDx = x4 - x3 vCDy = y4 - y3 #mx = vCDx / vABx #my = vCDy / vABy #if abs(mx - my) < 1e-10: if abs(vABx*vCDy - vCDx*vABy) < 1e-10: print("YES") else: print("NO") #print(mx-my) #
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,324
s565164696
p00021
u506132575
1416129256
Python
Python
py
Accepted
20
4260
390
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys err = 1e-10 def cross(v1,v2): return v1[0]*v2[1]-v1[1]*v2[0] num = input() for i in range(num): d = map(float,sys.stdin.readline().split()) x1,y1,x2,y2,x3,y3,x4,y4 = d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7] ab = [ x2-x1, y2-y1 ] cd = [ x4-x3, y4-y3 ] if abs(cross(ab,cd)) < err: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,325
s926285599
p00021
u567380442
1422793406
Python
Python3
py
Accepted
30
6756
372
import sys f = sys.stdin def take2(iterable): i = iter(iterable) while True: yield next(i) + next(i) * 1j def cross(ab, cd): return ab.real * cd.imag - ab.imag * cd.real n = int(f.readline()) for _ in range(n): a, b, c, d = [xiyi for xiyi in take2(map(float, f.readline().split()))] print('YES' if abs(cross(a - b, c - d)) < 1e-10 else 'NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,326
s066050289
p00021
u744114948
1425908947
Python
Python3
py
Accepted
40
6752
180
for _ in range(int(input())): a,b,c,d,e,f,g,h=map(float, input().split()) if abs((c-a)*(h-f) - (g-e)*(d-b)) < 1e-10: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,327
s773770410
p00021
u567380442
1426979156
Python
Python3
py
Accepted
30
6752
266
import sys def cross(a, b): return a.real * b.imag - a.imag * b.real n = sys.stdin.readline() for line in sys.stdin: a, b, c, d = [x + y * 1j for x, y in zip(* [map(float, line.split())] * 2)] print('YES' if abs(cross(a - b, c - d)) < 1e-10 else 'NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,328
s300142066
p00021
u621997536
1429239701
Python
Python3
py
Accepted
30
6748
182
n = int(input()) for i in range(n): p = list(map(float, input().split())) print("YES" if abs((p[3] - p[1]) * (p[6] - p[4]) - (p[7] - p[5]) * (p[2] - p[0])) < 1e-10 else "NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,329
s110055273
p00021
u067299340
1433390201
Python
Python
py
Accepted
10
4224
131
for a,b,c,d,e,f,g,h in[map(float,raw_input().split())for i in range(input())]:print["NO","YES"][abs((a-c)*(f-h)-(b-d)*(e-g))<1e-10]
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,330
s786379054
p00021
u880042992
1434897462
Python
Python3
py
Accepted
30
6752
185
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) print('YES' if abs((x2 - x1)*(y4 - y3) - (x4 - x3)*(y2 - y1)) < 1e-10 else 'NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,331
s152302614
p00021
u379956761
1434983659
Python
Python
py
Accepted
10
4256
493
N = input() for n in range(N): data = map(float,raw_input().split( )) slopes = [] for i in range(2): _x1 = data.pop(0) _y1 = data.pop(0) _x2 = data.pop(0) _y2 = data.pop(0) if _x1 != _x2: slopes.append((_y1 - _y2)/(_x1 - _x2)) if len(slopes) == 0: print "YES" elif len(slopes) == 1: print "NO" elif abs(slopes[0] - slopes[1]) < 1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,332
s956424738
p00021
u338932851
1436309109
Python
Python
py
Accepted
10
4248
397
import sys input_lines = sys.stdin.readlines() lines = map(lambda x: x[:-1], input_lines) lines = map(lambda x: x.split(" "), lines) n = int(lines[0][0]) lines.pop(0) for l in lines: x1, y1, x2, y2, x3, y3, x4, y4 = map(float, l) X1 = x2 - x1 X2 = x4 - x3 Y1 = y2 - y1 Y2 = y4 - y3 if abs(X1*Y2 - X2*Y1) < 1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,333
s305916996
p00021
u071010747
1445249517
Python
Python3
py
Accepted
20
7612
299
# -*- coding:utf-8 -*- def main(): for i in range(int(input())): x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split()) if abs((x2-x1)*(y4-y3)-(x4-x3)*(y2-y1))<1e-10: print("YES") else: print("NO") if __name__ == '__main__': main()
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,334
s272664374
p00021
u765849500
1446103171
Python
Python
py
Accepted
10
6448
405
import sys input_lines = sys.stdin.readlines() lines = map(lambda x: x[:-1], input_lines) lines = map(lambda x: x.split(" "), lines) n = int(lines[0][0]) lines.pop(0) for l in lines: x1, y1, x2, y2, x3, y3, x4, y4 = map(float, l) X1 = x2 - x1 X2 = x4 - x3 Y1 = y2 - y1 Y2 = y4 - y3 if abs(X1*Y2 - X2*Y1) < 1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,335
s661242915
p00021
u489809100
1446538941
Python
Python
py
Accepted
10
6292
220
n = int(raw_input()) for i in range(0, n): x1,y1,x2,y2,x3,y3,x4,y4 = map(float,raw_input().split()) z1 = (x1 - x2) * (y3 - y4) z2 = (x3 - x4) * (y1 - y2) if abs(z1 - z2) < 1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,336
s253750204
p00021
u140201022
1446989887
Python
Python
py
Accepted
10
6364
169
n=int(raw_input()) while n: n-=1 x1,y1,x2,y2,x3,y3,x4,y4=map(float,raw_input().split()) print 'YES' if abs((y3-y4)*(x1-x2)-(y1-y2)*(x3-x4))< 1e-10 else 'NO'
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,337
s662827477
p00021
u766163292
1447254747
Python
Python3
py
Accepted
30
8096
1,121
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import collections import math LIMIT = 1e-10 class Vector2(collections.namedtuple("Vector2", "x y")): __slots__ = () def __add__(self, other): return Vector2(self.x + other.x, self.y + other.y) def __sub__(self, other): return Vector2(self.x - other.x, self.y - other.y) def __mul__(self, other): return self.x * other.y - self.y * other.x def __neg__(self): return Vector2(-self.x, -self.y) def __pos__(self): return Vector2(+self.x, +self.y) def __abs__(self): return math.sqrt(float(self.x * self.x + self.y * self.y)) def dotproduct(self, other): return self.x * other.x + self.y * other.y def main(): n = int(input()) for i in range(n): [x1, y1, x2, y2, x3, y3, x4, y4] = [float(z) for z in input().split()] vector_ab = Vector2(x2 - x1, y2 - y1) vector_cd = Vector2(x4 - x3, y4 - y3) if abs(vector_ab * vector_cd) < LIMIT: print("YES") else: print("NO") if __name__ == "__main__": main()
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,338
s210188494
p00021
u211905117
1450858644
Python
Python3
py
Accepted
20
7560
236
N = int(input()) for i in range(0, N) : x1,y1,x2,y2,x3,y3,x4,y4 = list(map(float, input().split())) s = x2 - x1 t = y2 - y1 u = x4 - x3 v = y4 - y3; if (abs(s * v - t * u) < 1e-10) : print("YES") else : print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,339
s264876385
p00021
u825618558
1451575084
Python
Python3
py
Accepted
50
10132
702
import sys import decimal lines = sys.stdin.readlines() size = int(lines[0]) data = lines[1:len(lines)] for line in data: line = line.split(" ") inp = [] for i in line: inp.append(decimal.Decimal(i)) x = [] x.append(inp[0]) x.append(inp[2]) x.append(inp[4]) x.append(inp[6]) y = [] y.append(inp[1]) y.append(inp[3]) y.append(inp[5]) y.append(inp[7]) if x[1]==x[0] and x[3]==x[2]: print ("YES") elif x[1]==x[0] or x[3]==x[2]: print ("NO") else: tilt1 = (y[1]-y[0])/(x[1]-x[0]) tilt2 = (y[3]-y[2])/(x[3]-x[2]) if tilt1==tilt2: print ("YES") else: print ("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,340
s049926162
p00021
u749493116
1452446214
Python
Python
py
Accepted
10
6352
251
#!/usr/bin/env python # -*- coding: utf-8 -*- n = int(raw_input()) for i in range(n): xa, ya, xb, yb, xc, yc, xd, yd = map(float, raw_input().split(" ")) if abs((ya - yb)*(xc - xd) - (yc - yd)*(xa - xb)) < 1e-12:print "YES" else:print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,341
s948365824
p00021
u797673668
1452704236
Python
Python3
py
Accepted
30
7500
233
n = int(input()) for _ in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) dx12, dx34, dy12, dy34 = x1 - x2, x3 - x4, y1 - y2, y3 - y4 print('YES' if abs(dx12 * dy34 - dy12 * dx34) < 1e-10 else 'NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,342
s124474595
p00021
u777299405
1453880460
Python
Python3
py
Accepted
20
7632
199
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) print("YES" if abs((x2 - x1) * (y4 - y3) - (x4 - x3) * (y2 - y1)) < 1e-10 else 'NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,343
s732167940
p00021
u529386725
1454765998
Python
Python3
py
Accepted
20
7664
224
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) if abs( (x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3) ) < 1e-10: print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,344
s504836417
p00021
u529386725
1454766050
Python
Python3
py
Accepted
20
7672
413
def cross(x, y): return (x.conjugate() * y).imag def is_parallel(x, y): if abs(cross(x, y)) < 1e-10: return True return False n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) a = complex(x2, y2) - complex(x1, y1) b = complex(x4, y4) - complex(x3, y3) if is_parallel(a, b): print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,345
s497657412
p00021
u529386725
1454766104
Python
Python3
py
Accepted
30
7760
413
def cross(x, y): return (x.conjugate() * y).imag def is_parallel(x, y): if abs(cross(x, y)) < 1e-10: return True return False n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) a = complex(x2, y2) - complex(x1, y1) b = complex(x4, y4) - complex(x3, y3) if is_parallel(a, b): print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,346
s316907508
p00021
u650459696
1458574132
Python
Python3
py
Accepted
30
7692
358
for i in range(int(input())): s = list(map(float,input().split())) if s[1] - s[3] == 0 or s[5] - s[7] == 0: if s[1] - s[3] == s[5] - s[7] == 0: print('YES') else: print('NO') elif abs((s[0] - s[2]) / (s[1] - s[3]) - (s[4] - s[6]) / (s[5] - s[7])) < 1e-10: print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,347
s211778337
p00021
u148101999
1459231329
Python
Python
py
Accepted
10
6320
201
n = int(raw_input()) for l in range(n): x1,y1,x2,y2,x3,y3,x4,y4 = map(float,raw_input().split()) if abs((y4-y3)*(x2-x1)-(y2-y1)*(x4-x3))< 1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,348
s742813644
p00021
u130979865
1459947354
Python
Python
py
Accepted
10
6388
211
# -*- coding: utf-8 -*- n = int(raw_input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().split()) print "YES" if abs(((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3))) < 1e-10 else "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,349
s713869143
p00021
u572790226
1460332219
Python
Python3
py
Accepted
30
7568
234
n = int(input()) for line in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) d = (x2 - x1)*(y4 - y3) - (y2 - y1)*(x4 - x3) if -10**-11 <d < 10**-11: print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,350
s636687599
p00021
u910692917
1464681885
Python
Python3
py
Accepted
30
7576
442
n=int(input()) ESP=1e-10 for t in range(n): s=input() item=s.split() x=[] y=[] for i in range(4): x.append(float(item[i*2])) y.append(float(item[i*2+1])) if abs(x[0]-x[1])<=ESP or abs(x[2]-x[3])<=ESP: if abs(x[0]-x[1])<=ESP and abs(x[2]-x[3])<=ESP: print("YES") else: print("NO") else: if abs((y[0]-y[1])/(x[0]-x[1])-(y[2]-y[3])/(x[2]-x[3]))<=ESP: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,351
s813176685
p00021
u266872031
1466193813
Python
Python
py
Accepted
10
6452
470
def multitoint(stringnum): [sei,sho]=stringnum.split('.') if len(sho)<=5: sho+='0'*(5-len(sho)) return int(sei+sho) n=int(raw_input()) for i in range(n): [x1,y1,x2,y2,x3,y3,x4,y4]=[multitoint(x) for x in raw_input().split()] [X1,Y1]=[x2-x1,y2-y1] [X2,Y2]=[x4-x3,y4-y3] ans="NO" if X2*Y1==X1*Y2: if X2*Y1!=0: ans="YES" else: if (X1==X2 or Y1==Y2): ans="YES" print ans
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,352
s346197848
p00021
u766477342
1466821074
Python
Python3
py
Accepted
30
7824
526
import math def equal(x, y): return math.fabs(x - y) <= 10 ** (-10) def spam(_x1, _y1, _x2, _y2): if _x1 > _x2: return _x1, _y1, _x2, _y2 else: return _x2, _y2, _x1, _y1 for i in range(int(input())): x1, y1, x2, y2, x3, y3, x4, y4 = list(map(float, input().split())) b1 = (x1 - x2, y1 - y2) b2 = (x3 - x4, y3 - y4) p = 0 if b2[0] != 0 else 1 q = 1 if b2[0] != 0 else 0 t = b1[p]/b2[p] if equal(b1[q], b2[q] * t): print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,353
s648284454
p00021
u203261375
1467535249
Python
Python3
py
Accepted
20
7500
199
n = int(input()) for i in range(n): x1,y1,x2,y2,x3,y3,x4,y4 = map(float, input().split()) if abs((y1-y2)*(x4-x3) - (y4-y3)*(x1-x2)) < 1e-10: print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,354
s468267081
p00021
u582608581
1471418994
Python
Python3
py
Accepted
40
7472
333
N = eval(input()) for _ in range(N): x1, y1, x2, y2, x3, y3, x4, y4 = [eval(item) for item in input().split()] if abs(x1 - x2) < 1e-10 or abs(x3 - x4) < 1e-10: print('YES' if abs(x1 - x2) < 1e-10 and abs(x3 - x4) < 1e-10 else 'NO') elif abs((y1 - y2)/(x1 - x2) - (y3 - y4)/(x3 - x4)) < 1e-10: print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,355
s022098403
p00021
u358919705
1471980377
Python
Python3
py
Accepted
20
7496
260
for _ in range(int(input())): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) ab = [x2 - x1, y2 - y1] cd = [x4 - x3, y4 - y3] if abs(ab[0] * cd[1] - ab[1] * cd[0]) > 0.00000000001: print('NO') else: print('YES')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,356
s034180234
p00021
u058433718
1474075133
Python
Python3
py
Accepted
50
10076
1,246
# ????????????????????°?????? import sys from decimal import Decimal def is_parallel(x1, y1, x2, y2, x3, y3, x4, y4): d1x = x2 - x1 d1y = y2 - y1 d2x = x4 - x3 d2y = y4 - y3 return d1x * d2y == d1y * d2x # if d1x != 0.0 and d2x != 0.0: # #a1 = d1y / d1x # #a2 = d2y / d2x # #return a1 == a2 # return d1x * d2y == d1y * d2x # if d1x == 0.0 and d2x == 0.0: # return True # return False def main(): n = int(sys.stdin.readline().strip()) for _ in range(n): data = sys.stdin.readline().strip().split(' ') # x1 = float(data[0]) # y1 = float(data[1]) # x2 = float(data[2]) # y2 = float(data[3]) # x3 = float(data[4]) # y3 = float(data[5]) # x4 = float(data[6]) # y4 = float(data[7]) x1 = Decimal(data[0]) y1 = Decimal(data[1]) x2 = Decimal(data[2]) y2 = Decimal(data[3]) x3 = Decimal(data[4]) y3 = Decimal(data[5]) x4 = Decimal(data[6]) y4 = Decimal(data[7]) if is_parallel(x1, y1, x2, y2, x3, y3, x4, y4): print('YES') else: print('NO') if __name__ == '__main__': main()
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,357
s544337875
p00021
u058433718
1474075189
Python
Python3
py
Accepted
50
10108
771
# ????????????????????°?????? import sys from decimal import Decimal def is_parallel(x1, y1, x2, y2, x3, y3, x4, y4): d1x = x2 - x1 d1y = y2 - y1 d2x = x4 - x3 d2y = y4 - y3 return d1x * d2y == d1y * d2x def main(): n = int(sys.stdin.readline().strip()) for _ in range(n): data = sys.stdin.readline().strip().split(' ') x1 = Decimal(data[0]) y1 = Decimal(data[1]) x2 = Decimal(data[2]) y2 = Decimal(data[3]) x3 = Decimal(data[4]) y3 = Decimal(data[5]) x4 = Decimal(data[6]) y4 = Decimal(data[7]) if is_parallel(x1, y1, x2, y2, x3, y3, x4, y4): print('YES') else: print('NO') if __name__ == '__main__': main()
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,358
s401728238
p00021
u372789658
1475905261
Python
Python3
py
Accepted
20
7556
522
num=int(input()) for i in range (num): info=list(map(float,input().split())) info=list(map(lambda x:int(x*10**10),info)) if info[2]==info[0]: if info[6]==info[4]: print("YES") else: print("NO") elif info[6]==info[4]: if info[2]==info[0]: print("YES") else: print("NO") else: if (info[3]-info[1])/(info[2]-info[0])==(info[7]-info[5])/(info[6]-info[4]): print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,359
s014377319
p00021
u372789658
1475905392
Python
Python3
py
Accepted
30
7684
521
num=int(input()) for i in range (num): info=list(map(float,input().split())) info=list(map(lambda x:int(x*10**6),info)) if info[2]==info[0]: if info[6]==info[4]: print("YES") else: print("NO") elif info[6]==info[4]: if info[2]==info[0]: print("YES") else: print("NO") else: if (info[3]-info[1])/(info[2]-info[0])==(info[7]-info[5])/(info[6]-info[4]): print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,360
s040082929
p00021
u964040941
1479224883
Python
Python3
py
Accepted
20
7604
382
N = int(input()) EPS = 1e-9 for i in range(N): x1,y1,x2,y2,x3,y3,x4,y4 = map(float,input().split()) if x2 == x1 and x4 == x3: print('YES') continue elif x2 == x1 or x4 == x3: print('NO') continue f = (y2 - y1) / (x2 - x1) g = (y4 - y3) / (x4 - x3) if g - EPS <= f <= g + EPS: print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,361
s082076973
p00021
u922871577
1479343719
Python
Python
py
Accepted
40
7904
305
from fractions import Fraction as F for _ in xrange(input()): x1, y1, x2, y2, x3, y3, x4, y4 = map(F, raw_input().split()) if x1 == x2 and x3 == x4: print 'YES' elif x1 == x2 or x3 == x4: print 'NO' else: print 'YES' if F(y2-y1, x2-x1) == F(y4-y3, x4-x3) else 'NO'
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,362
s877972176
p00021
u898097781
1481391283
Python
Python
py
Accepted
10
6256
343
n = int(raw_input()) for i in range(n): x0, y0, x1, y1, x2, y2, x3, y3 = map(float, raw_input().split(' ')) if x0==x1 or x2==x3: if x0==x1 and x2==x3: print 'YES' else: print 'NO' elif abs(float(y1-y0)/(x1-x0) - float(y3-y2)/(x3-x2)) < 1e-10: print 'YES' else: print 'NO'
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,363
s765945442
p00021
u711765449
1484413888
Python
Python3
py
Accepted
20
7696
461
# -*- coding:utf-8 -*- def check_para(x1,y1,x2,y2,x3,y3,x4,y4): if x1 == x2 and x4 == x3: print('YES') return 0 elif x1 == x2 or x3 == x4: print('NO') return 0 k1 = (y2-y1)/(x2-x1) k2 = (y4-y3)/(x4-x3) if abs(k1-k2) < 1e-10: print('YES') else: print('NO') n = int(input()) for i in range(n): x1,y1,x2,y2,x3,y3,x4,y4 = map(float,input().split()) check_para(x1,y1,x2,y2,x3,y3,x4,y4)
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,364
s153885370
p00021
u078042885
1485354763
Python
Python3
py
Accepted
20
7636
162
for _ in range(int(input())): ax, ay, bx, by, cx, cy, dx, dy = map(float, input().split()) print(['NO','YES'][abs((ay-by)*(dx-cx)-(ax-bx)*(dy-cy))<1e-10])
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,365
s500960543
p00021
u901080241
1488967232
Python
Python3
py
Accepted
30
7492
217
for i in range(int(input())): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) det = abs((y1-y2) * (x3-x4) - (x1-x2) * (y3-y4)) if det<1e-12 : print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,366
s724483152
p00021
u179694829
1490075175
Python
Python3
py
Accepted
60
10016
348
from fractions import Fraction def sroap(x1,y1,x2,y2): if x2 - x1 == 0: return float("inf") else: return Fraction(y2 - y1,x2 - x1) N = int(input()) for n in range(N): Ax,Ay,Bx,By,Cx,Cy,Dx,Dy = map(lambda x: round(x * 10 ** 5),(map(float,input().split()))) if sroap(Ax,Ay,Bx,By) == sroap(Cx,Cy,Dx,Dy): print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,367
s967700828
p00021
u072398496
1490151358
Python
Python
py
Accepted
10
6284
325
n=input() for i in range(n): a,b,c,d,e,f,g,h=map(float,raw_input().split()) # if a==c and g==e:print "YES" # if a==c and g!=e:print "NO" # if a!=c and g==e:print "NO" # if a!=c and g!=e: # if (d-b)/(c-a)==(h-f)/(g-e):print "YES" # else:print "NO" if -1e-10<(d-b)*(g-e)-(c-a)*(h-f)<1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,368
s617719149
p00021
u072398496
1490151427
Python
Python
py
Accepted
10
6280
152
n=input() for i in range(n): a,b,c,d,e,f,g,h=map(float,raw_input().split()) if -1e-10<(d-b)*(g-e)-(c-a)*(h-f)<1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,369
s428971184
p00021
u072398496
1490151792
Python
Python
py
Accepted
10
6288
133
for i in range(input()): a,b,c,d,e,f,g,h=map(float,raw_input().split()) print "YES" if abs((d-b)*(g-e)-(c-a)*(h-f))<1e-10 else "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,370
s618854064
p00021
u462831976
1492716193
Python
Python3
py
Accepted
20
7596
330
# -*- coding: utf-8 -*- import sys import os N = int(input()) for i in range(N): ax, ay, bx, by, cx, cy, dx, dy = list(map(float, input().split())) AB = (bx - ax, by - ay) CD = (dx - cx, dy - cy) cross = AB[0] * CD[1] - AB[1] * CD[0] if abs(cross) < 1e-10: print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,371
s756963846
p00021
u905313459
1496409914
Python
Python3
py
Accepted
10
7648
149
n = int(input()) for i in range(n): a,e,b,f,c,g,d,h=map(float,input().split()) print("YES" if abs((b-a)*(h-g)-(d-c)*(f-e)) < 1e-10 else "NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,372
s614084791
p00021
u957840591
1497489793
Python
Python3
py
Accepted
20
7764
358
ABs=[] CDs=[] n = int(input()) for i in range(n): x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4, = map(float, input().split()) AB = [x_2 - x_1, y_2 - y_1] CD = [x_4 - x_3, y_4 - y_3] ABs.append(AB) CDs.append(CD) for i in range(n): if abs(ABs[i][0]*CDs[i][1]-ABs[i][1]*CDs[i][0])<10**(-10): print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,373
s250882362
p00021
u371539389
1497871447
Python
Python3
py
Accepted
60
9956
261
from decimal import Decimal as D n=int(input()) for loop in range(n): x1,y1,x2,y2,x3,y3,x4,y4=[D(i) for i in input().split(" ")] AB=[x2-x1,y2-y1] CD=[x4-x3,y4-y3] if AB[0]*CD[1]==AB[1]*CD[0]: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,374
s554875120
p00021
u354053070
1501982413
Python
Python3
py
Accepted
30
7652
218
n = int(input()) for _ in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) if abs((x2 - x1) * (y4 - y3) - (x4 - x3) * (y2 - y1)) < 1e-10: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,375
s556141498
p00021
u957021183
1504776025
Python
Python3
py
Accepted
30
7700
382
# Aizu Problem 0021: Parallelism # import sys, math, os # read input: PYDEV = os.environ.get('PYDEV') if PYDEV=="True": sys.stdin = open("sample-input.txt", "rt") N = int(input()) for n in range(N): x1, y1, x2, y2, x3, y3, x4, y4 = [float(_) for _ in input().split()] det = (x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3) print("YES" if abs(det) < 1e-10 else "NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,376
s040034718
p00021
u811733736
1505373763
Python
Python3
py
Accepted
30
8080
7,047
# -*- 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 abs(Vector.dot(a, b)) < Vector.epsilon @classmethod def is_parallel(cls, a, b): return abs(Vector.cross(a, b)) < Vector.epsilon 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): n = int(input()) for _ in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().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_parallel(AB, CD) if result: print('YES') else: print('NO') if __name__ == '__main__': main(sys.argv[1:])
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,377
s351179648
p00021
u236679854
1506116949
Python
Python3
py
Accepted
20
7616
322
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) if x1 == x2 and x3 == x4: print("YES") elif x1 == x2 or x3 == x4: print("NO") elif abs((y2 - y1) / (x2 - x1) - (y4 - y3) / (x4 - x3)) < 1e-10: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,378
s770736194
p00021
u917432951
1511339513
Python
Python3
py
Accepted
50
7716
570
if __name__ == '__main__': n = int(input()) for _ in range(n): x1,y1,x2,y2,x3,y3,x4,y4 = map(float,input().split()) #print((y2-y1)/(x2-x1) - (y4-y3)/(x4-x3)) '''if math.fabs(x1 - x2) <= 0.00001 and math.fabs( x3 - x4) <= 0.00001: print("YES") elif math.fabs(x1 - x2) <= 0.00001: print("NO") elif math.fabs(x3 - x4) <= 0.00001: print("NO") else: ''' if abs((x2-x1) * (y4-y3)-(x4-x3)*(y2-y1)) < 1e-10: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,379
s341779829
p00021
u928329738
1511777523
Python
Python3
py
Accepted
30
7604
165
n = int(input()) for i in range(n): x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split()) print("YES" if abs((y2-y1)*(x4-x3)-(x2-x1)*(y4-y3)) < 1e-10 else "NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,380
s905425920
p00021
u205327055
1513222936
Python
Python
py
Accepted
10
4660
186
n = int(raw_input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, raw_input().split()) print "YES" if abs(((y2-y1)*(x4-x3) - (x2-x1)*(y4-y3))) < 1e-10 else "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,381
s614686479
p00021
u299798926
1513226685
Python
Python3
py
Accepted
20
5604
236
count = int(input()) for i in range(count): x = list(map(float ,input().split())) x1=x[2]-x[0] y1=x[3]-x[1] x2=x[6]-x[4] y2=x[7]-x[5] if abs(x1*y2-x2*y1)<=1e-10: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,382
s662030259
p00021
u028347703
1514695694
Python
Python3
py
Accepted
30
5620
312
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = [float(j) * 10**10 for j in input().split()] if x2 == x1: if x4 == x3: print("YES") else: print("NO") elif x4 == x3: print("NO") else: print("YES" if (y2 - y1) / (x2 - x1) == (y4 - y3) / (x4 - x3) else "NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,383
s408191983
p00021
u024715419
1515140296
Python
Python3
py
Accepted
20
5608
208
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) if abs((x2-x1)*(y4-y3) - (y2-y1)*(x4-x3)) < 1e-10: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,384
s744595387
p00021
u298999032
1515141917
Python
Python3
py
Accepted
20
5608
162
n=int(input()) for i in range(n): x1,y1,x2,y2,x3,y3,x4,y4=map(float,input().split()) print('YES' if abs((y1-y2)*(x3-x4)-(y3-y4)*(x1-x2))<1e-10 else 'NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,385
s419797147
p00021
u566872786
1515142121
Python
Python3
py
Accepted
20
5612
236
for i in range(int(input())): a,b,c,d,e,f,g,h = map(float,input().split()) if a == c: print("YES" if e == g else "NO") elif e == g: print("NO") else: print("YES" if abs((b-d)/(a-c) - (f-h)/(e-g)) < 1e-10 else "NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,386
s351248040
p00021
u150984829
1516901037
Python
Python3
py
Accepted
20
5620
127
for _ in[0]*int(input()): a,b,c,d,e,f,g,h=map(float,input().split()) print(['NO','YES'][abs((a-c)*(f-h)-(e-g)*(b-d))<1e-10])
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,387
s483209614
p00021
u328199937
1519042837
Python
Python3
py
Accepted
20
5604
203
n = int(input()) for i in range(n): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) if abs((x2 - x1) * (y4 - y3) - (y2 - y1) * (x4 - x3)) < 1e-10: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,388
s357757378
p00021
u166871988
1523770270
Python
Python3
py
Accepted
20
5628
196
n=int(input()) for j in range(n): p=[float(i) for i in input().split()] if round((p[2]-p[0])*(p[7]-p[5])-(p[3]-p[1])*(p[6]-p[4]),10)==0: print("YES") else: print("NO")
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,389
s707372173
p00021
u724548524
1525754411
Python
Python3
py
Accepted
20
5616
179
for _ in range(int(input())): x1, y1, x2, y2, x3, y3, x4, y4 = map(float, input().split()) print(["NO","YES"][abs((x1 - x2) * (y3 - y4) - (x3 - x4) * (y1 - y2)) < 1e-10])
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,390
s158503714
p00021
u847467233
1529211919
Python
Python3
py
Accepted
30
5628
743
# AOJ 0021: Parallelism # Python3 2018.6.15 bal4u EPS = 1e-11 def dot(a, b): return a.real*b.real + a.imag*b.imag def cross(a, b): return a.real*b.imag - a.imag*b.real def norm(a): return a.real**2 + a.imag**2 def project(line, p): base = line[1]-line[0] r = dot(p-line[0], base) / norm(base) return line[0] + base*r def symmetric_Point(line, p): return p + 2*(project(line, p)-p) def isParallelLL(line1, line2): t = cross(line1[1]-line1[0], line2[1]-line2[0]) return -EPS <= t and t <= EPS for _ in range(int(input())): p = list(map(float, input().split())) p1 = complex(p[0], p[1]) p2 = complex(p[2], p[3]) p3 = complex(p[4], p[5]) p4 = complex(p[6], p[7]) print('YES' if isParallelLL([p1,p2], [p3,p4]) else 'NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,391
s328771284
p00021
u504990413
1353418276
Python
Python
py
Accepted
10
5648
346
num =input() for i in range(num): x = map(float, raw_input().split(' ')) if x[1]-x[3] == 0 or x[5]-x[7] == 0: if x[1]-x[3] == 0 and x[5]-x[7] == 0: print 'YES' else: print 'NO' elif (x[0]-x[2])/(x[1]-x[3]) == (x[4]-x[6])/(x[5]-x[7]): print 'YES' else: print 'NO'
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,392
s724183800
p00021
u647766105
1354428267
Python
Python
py
Accepted
20
4248
233
for i in range(input()): a= map(float,raw_input().split()) vx=[a[i]-a[i+2] for i in range(0,8,4)] vy=[a[i]-a[i+2] for i in range(1,8,4)] if(vx[0]*vy[1]-vx[1]*vy[0]==0): print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,393
s779634497
p00021
u419407022
1356112999
Python
Python
py
Accepted
10
23000
380
for i in range(int(raw_input())): (x1, y1, x2, y2, x3, y3, x4, y4) = map(float,raw_input().split()) x1 -= x2 y1 -= y2 x3 -= x4 y3 -= y4 if(x1 == 0 or x3 == 0): if(x1 == 0 and x3 == 0): print 'YES' else: print 'NO' else: if(y1 / x1 == y3 / x3): print 'YES' else: print 'NO'
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,394
s243839382
p00021
u782850731
1362103966
Python
Python
py
Accepted
20
4276
435
from __future__ import (absolute_import, division, print_function, unicode_literals) from sys import stdin def gradient(x1, y1, x2, y2): if x1 - x2 == 0.0: return float('inf') return (y1 - y2) / (x1 - x2) for n in xrange(int(stdin.readline())): p = [float(s) for s in stdin.readline().split()] if gradient(*p[:4]) == gradient(*p[4:]): print('YES') else: print('NO')
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,395
s773594668
p00021
u282635979
1363437514
Python
Python
py
Accepted
10
4272
342
n = input() + 1 for val in range(1,n): x = map(float,raw_input().split(' ')) if x[1]-x[3] == 0 and x[5]-x[7] == 0: print 'YES' elif x[1]-x[3] != 0 and x[5]-x[7] == 0: print 'NO' elif x[1]-x[3] == 0 and x[5]-x[7] != 0: print 'NO' else: if (x[0]-x[2])/(x[1]-x[3]) == (x[4]-x[6])/(x[5]-x[7]): print 'YES' else: print 'NO'
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,396
s031203503
p00021
u542421762
1368279997
Python
Python
py
Accepted
20
4256
481
import sys def parallelism(x1, y1, x2, y2, x3, y3, x4, y4): if x2 - x1 == 0.0 or x4 - x3 == 0.0: return x2 - x1 == 0.0 and x4 - x3 == 0.0 else: return ((y2 - y1) / (x2 - x1)) == ((y4 - y3) / (x4 - x3)) #lines = sys.stdin.readlines() #lines.pop(0) for i in range(input()): x1, y1, x2, y2, x3, y3, x4, y4 = tuple(map(float, raw_input().split(' '))) if parallelism(x1, y1, x2, y2, x3, y3, x4, y4): print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,397
s617000018
p00021
u912237403
1377977774
Python
Python
py
Accepted
10
4372
200
import math n = int(raw_input()) for i in range(n): x1,y1,x2,y2,x3,y3,x4,y4 = map(float, raw_input().split()) if (abs((y1-y2)*(x3-x4)-(y3-y4)*(x1-x2))<1e-10): print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,398
s633564503
p00021
u230836528
1392307942
Python
Python
py
Accepted
10
4372
1,017
import sys def norm2d(vec): return (vec[0]**2 + vec[1]**2)**0.5 def normalize(vec): l = norm2d(vec) vec[0] /= l vec[1] /= l return vec lineNumber = 0 #for line in ["2", "0.0 0.0 -9.0 -9.0 1.0 0.0 2.0 1.0", "3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0"]: for line in sys.stdin.readlines(): lineNumber += 1 if lineNumber == 1: continue # get data List = map(float, line.strip().split(" ")) # set data a = [List[0], List[1]] b = [List[2], List[3]] c = [List[4], List[5]] d = [List[6], List[7]] vec1 = [a[0]-b[0], a[1]-b[1]] vec2 = [c[0]-d[0], c[1]-d[1]] #print vec1, vec2 if vec1[0] < 0: vec1[0] *= -1 vec1[1] *= -1 if vec2[0] < 0: vec2[0] *= -1 vec2[1] *= -1 #print vec1, vec2 vec1 = normalize(vec1) vec2 = normalize(vec2) #print vec1, vec2 if abs( vec1[0] - vec2[0] ) < 10**(-10) \ and abs( vec1[1] - vec2[1] ) < 10**(-10): print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,399
s317774605
p00021
u633068244
1393383463
Python
Python
py
Accepted
20
4232
204
n = int(raw_input()) for i in range(n): x1,y1,x2,y2,x3,y3,x4,y4 = map(float, raw_input().split()) if abs((y4-y3)*(x2-x1)-(y2-y1)*(x4-x3)) < 1e-10: print "YES" else: print "NO"
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,400
s169451878
p00021
u912237403
1394222691
Python
Python
py
Accepted
10
4360
160
import math N=range(int(raw_input())) for i in N: a,w,b,x,c,y,d,z=map(float, raw_input().split()) print ["NO","YES"][abs((w-x)*(c-d)-(y-z)*(a-b))<1e-10]
p00021
<script type="text/x-mathjax-config"> MathJax.Hub.Config({ tex2jax: { inlineMath: [["$","$"], ["\\(","\\)"]], processEscapes: true }}); </script> <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <H1>Parallelism</H1> <p> There are four points: $A(x_1, y_1)$, $B(x_2, y_2)$, $C(x_3, y_3)$, and $D(x_4, y_4)$. Write a program which determines whether the line $AB$ and the line $CD$ are parallel. If those two lines are parallel, your program should prints "<span>YES</span>" and if not prints "<span>NO</span>". </p> <H2>Input</H2> <p> Input consists of several datasets. In the first line, you are given the number of datasets $n$ ($n \leq 100$). There will be $n$ lines where each line correspondgs to each dataset. Each dataset consists of eight real numbers:<br/> <br/> $x_1$ $y_1$ $x_2$ $y_2$ $x_3$ $y_3$ $x_4$ $y_4$<br/> </p> <p> You can assume that $-100 \leq x_1, y_1, x_2, y_2, x_3, y_3, x_4, y_4 \leq 100$. Each value is a real number with at most 5 digits after the decimal point. </p> <H2>Output</H2> <p> For each dataset, print "<span>YES</span>" or "<span>NO</span>" in a line. </p> <H2>Sample Input</H2> <pre> 2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0 </pre> <H2>Output for the Sample Input</H2> <pre> YES NO </pre>
2 0.0 0.0 1.0 1.0 1.0 0.0 2.0 1.0 3.0 2.0 9.0 6.0 13.0 5.0 7.0 9.0
YES NO
7,401