Created
July 5, 2017 14:25
-
-
Save khannasarthak/c684e0d1f0dea06b17c674f25dcab85c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dist(a,b): | |
return ((a[0]-b[0])**2 + (a[1] -b[1])**2) | |
t = int(input()) | |
while (t!=0): | |
a = list(map(int,(input().split(' ')))) | |
k = [a[i:i+2] for i in range(0, len(a), 2)] | |
p1 = k[0] | |
p2 = k[1] | |
p3 = k[2] | |
p4 = k[3] | |
d1 = dist(p1,p2) | |
d2 = dist(p1,p3) | |
d3 = dist(p1,p4) | |
if (p1==p2==p3==p4): | |
print (0) | |
elif (d1==d2 and d2*2==d3): | |
if (dist(p4,p2)==dist(p4,p3)): | |
print (1) | |
elif (d2==d3 and d3*2==d1): | |
if (dist(p4,p2)==dist(p2,p3)): | |
print (1) | |
elif (d3==d1 and d1*2==d2): | |
if (dist(p4,p3)==dist(p2,p3)): | |
print (1) | |
else: | |
print (0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment