Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- s = [list(map(int, input().split())) for i in range(8)]
- for p in range(256):
- ans = True
- a = s[:][:]
- u = [0 for i in range(33)]
- for i in range(8):
- x = -1
- if (2 ** i) & p > 0:
- x = 1
- for j in range(8):
- if a[i][j] * x < 0:
- if u[abs(a[i][j])] == 0 and i < 7 and a[i+1][j] == -a[i][j]:
- t = a[i+1][j]
- a[i+1][j] = a[i][j]
- a[i][j] = t
- else:
- ans = False
- u[abs(a[i][j])] = 1
- if ans:
- print('YES')
- raise SystemExit(0)
- print('NO')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement