Stones Placing

Stones Placing

The mission is in Blocked Mode. Access to the solutions is blocked for a day or two (even after you share your own), until we'll have enough solutions for you to check. All users who've solved the mission will get the notifications about their opening.

The Master created a board game that consists of filling a rectangular (not necessary square) board with white and black stones. The cells in the first row and first column are randomly filled with white (0) or black (1) stones. The remaining cells are filled according to the rule that the color of a cell depends on the color of the three cells adjacent to it (top, left, top-left): if there are more white stones than black stones, the cell is filled with a white stone, and vice versa.

example

You are given the first row and column and your program must calculate the color of the stone in the bottom right cell.

Input: Two lists of integers (int).

Output: Integer.

Examples:

assert stones_placing([0, 0, 1, 0, 0, 0], [0, 1, 0, 0, 1, 1]) == 0
assert stones_placing([0, 1, 0], [0, 1, 1]) == 1
assert stones_placing([0, 0, 1, 0, 0], [0, 1, 0, 0, 1, 1]) == 0
assert stones_placing([1, 1, 0, 1], [1, 1, 0, 1]) == 1

Preconditions:

  • len(row), len(col) > 1;
  • row[0] == col[0].