Source: CGMO-2015-P3
Category: Extremal Problems

Problem: Consider a $12\\times12$ grid where each cell is colored either black or white, such that every $3\\times4$ or $4\\times3$ subgrid contains at least one black cell. Find the minimum number of black cells required.

Answer: 12

Reference solution:
Because a $12\times 12$ grid can be partitioned into $\frac{12\times 12}{3\times 4}=12$ disjoint $3\times 4$ subgrids, there must be at least $12$ black cells.

Multiple valid configurations with exactly $12$ black cells that satisfy the requirements can be constructed. Therefore, the minimum number of black cells required is $12$.

Grading guidelines:
(Partial) 1. Observed that the board can be tiled by disjoint 3×4 rectangles (e.g. 4 by 3 array of blocks), and concluded at least one black cell is needed in each block. 2. Gave an explicit placement pattern with 12 black cells and argued it meets the condition for all 3×4 (and/or 4×3) subgrids, but did not justify minimality. 3. Proved a weaker correct lower bound (e.g. ≥10 or ≥11) using any valid disjoint-family/covering argument, even if not sharp. (Almost) 1. Correctly proved the lower bound 12 via a partition into 12 disjoint 3×4 subgrids, but did not supply (or did not fully verify) a configuration achieving 12. 2. Gave a correct construction with 12 black cells, and a correct lower bound argument, but left a small gap such as not checking one orientation (3×4 vs 4×3) or not clearly justifying that the chosen 12 rectangles are disjoint and cover the whole board. 3. Solution is almost complete, but made minor mistakes which are not negligible.

Construction task:
Provide an explicit construction for the grid that achieves this minimum number of black cells.

Construction requirements:
- Output a single Python list of lists representing the $12 \times 12$ grid.
- Use the integer `0` to represent a white cell and `1` to represent a black cell.
- Your grid must contain the minimum possible number of black cells such that every $3 \times 4$ subgrid and every $4 \times 3$ subgrid contains at least one black cell.
- Put ONLY the Python literal inside the construction block.

Reference construction:
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

Verifier code:
import sys
import ast

def verify():
    payload = sys.stdin.read().strip()
    if not payload:
        print("Empty input.")
        return

    try:
        grid = ast.literal_eval(payload)
    except Exception as e:
        print(f"Failed to parse python literal: {e}")
        return
    
    if not isinstance(grid, list):
        print("Grid must be a list.")
        return
    
    if len(grid) != 12:
        print(f"Grid must have exactly 12 rows, got {len(grid)}.")
        return
        
    for i, row in enumerate(grid):
        if not isinstance(row, list):
            print(f"Row {i} is not a list.")
            return
        if len(row) != 12:
            print(f"Row {i} must have exactly 12 elements, got {len(row)}.")
            return
        for j, val in enumerate(row):
            if type(val) is not int or val not in (0, 1):
                print(f"Element at ({i}, {j}) is not the integer 0 or 1, got {val!r}.")
                return
                
    total_ones = sum(sum(row) for row in grid)
    if total_ones != 12:
        print(f"Total number of 1s must be exactly 12, got {total_ones}.")
        return
        
    # Check 3x4 subgrids
    for r in range(10):
        for c in range(9):
            subgrid_sum = sum(grid[r+i][c+j] for i in range(3) for j in range(4))
            if subgrid_sum < 1:
                print(f"3x4 subgrid starting at ({r}, {c}) has no black cells.")
                return
                
    # Check 4x3 subgrids
    for r in range(9):
        for c in range(10):
            subgrid_sum = sum(grid[r+i][c+j] for i in range(4) for j in range(3))
            if subgrid_sum < 1:
                print(f"4x3 subgrid starting at ({r}, {c}) has no black cells.")
                return
                
    print("True")

if __name__ == "__main__":
    verify()