Taigar2000

B

Oct 17th, 2020
616
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def len2(a, b):
  2.     c = 0.
  3.     for j in range(len(a[1])):
  4.         c += (a[1][j]-b[1][j])**2
  5.     return c
  6.  
  7. def isrect(a, b, c):
  8.     return len2(a, b)+len2(b, c) == len2(a, c)
  9.  
  10. n = int(input())
  11. m = int(input())
  12. p = []
  13. for i in range(m):
  14.     b = input().split()
  15.     p.append([b[0], list(map(int, b[1:]))])
  16. res = []
  17. for i in range(len(p)):
  18.     for j in p:
  19.         if(p[i][0] == j[0]):
  20.             continue
  21.         for k in range(i+1, len(p)):
  22.             if(p[i][0] == p[k][0] or j[0] == p[k][0]):
  23.                 continue
  24.             if(isrect(p[i], j, p[k])):
  25.                 res.append(""+p[i][0]+' '+j[0]+' '+p[k][0])
  26. print(*res, sep='\n')
  27.  
RAW Paste Data