Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. a = []
  2. for i in range(8):
  3.     a.append(list(map(int, input().split())))
  4. for i in range(7):
  5.     mult = True
  6.     for j in range(7):
  7.         if a[i][j] // abs(a[i][j]) != a[i][j + 1] // abs(a[i][j + 1]):
  8.             mult = False
  9.     if mult == True:
  10.         continue
  11.     else:
  12.         for j in range(8):
  13.             if a[i][j] < 0:
  14.                 tmp1 = a[i + 1][j]
  15.                 tmp2 = a[i][j]
  16.                 a[i][j] = tmp1
  17.                 a[i + 1][j] = tmp2
  18.                 mult1 = True
  19.                 for k in range(7):
  20.                     if a[i][k] // abs(a[i][k]) != a[i][k + 1] // abs(a[i][k + 1]):
  21.                         mult1 = False
  22.                 if mult1 == True:
  23.                     break
  24. mult2 = []
  25. for i in range(8):
  26.     multc = True
  27.     for j in range(7):
  28.         if a[i][j] // abs(a[i][j]) != a[i][j + 1] // abs(a[i][j + 1]):
  29.             multc = False
  30.             mult2.append(multc)
  31.     if multc == False:
  32.         print("NO")
  33.         break
  34. if False not in mult2:
  35.     print("YES")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement