FA-52606 / Raster memory layout / Open access
Sparse Resident Tile Map: Residency predicate rejects slot zero or accepts missing tiles · case 01
The returned physical layout descriptor disagrees with the declared buffer mapping at resident.
ROOT CAUSE
Residency predicate rejects slot zero or accepts missing tiles The faulty expression is bool(slot).
VERIFIED REPAIR
Apply the stipulated layout rule at resident: slot is not None.
Unsuccessful approach: The attempted repair uses True and still violates the layout contract.
Case contract
A 4x4 tiled texture has a virtual tile directory mapping tile IDs to optional physical slots. Physical slots have two-byte tags; absent slots use a supplied fallback byte address and must not be interpreted as slot zero. Return the named intermediate layout descriptor and final address fields; all quantities are integer byte offsets unless explicitly stated.
Why this case matters
Offline raster resource, upload, readback, and storage-layout regression model.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(p):
p = dict(p)
tile_columns = (p["w"]+3)//4
virtual_id = (p["y"]//4)*tile_columns+p["x"]//4
slot = p["slots"][virtual_id]
resident = bool(slot)
slot_pitch = 16*p["b"]+2
local_index = (p["y"]%4)*4+p["x"]%4
physical_start = p["base"]+(slot if slot is not None else 0)*slot_pitch
candidate = physical_start+2+local_index*p["b"]
address = candidate if resident else p["fallback"]
directory_entry = p["base"]+virtual_id*4
return {'tile_columns': tile_columns, 'virtual_id': virtual_id, 'slot': slot, 'resident': resident, 'slot_pitch': slot_pitch, 'local_index': local_index, 'physical_start': physical_start, 'candidate': candidate, 'address': address, 'directory_entry': directory_entry}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 10, 'h': 10, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 34, 'local_index': 0, 'physical_start': 11, 'candidate': 13, 'address': 3, 'directory_entry': 11}), ({'w': 11, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 34, 'local_index': 5, 'physical_start': 113, 'candidate': 125, 'address': 125, 'directory_entry': 15}), ({'w': 10, 'h': 10, 'x': 8, 'y': 2, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 34, 'local_index': 8, 'physical_start': 11, 'candidate': 29, 'address': 29, 'directory_entry': 19}), ({'w': 11, 'h': 10, 'x': 1, 'y': 5, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 3, 'slot': 2, 'resident': True, 'slot_pitch': 34, 'local_index': 5, 'physical_start': 79, 'candidate': 91, 'address': 91, 'directory_entry': 23}), ({'w': 10, 'h': 10, 'x': 6, 'y': 4, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 34, 'local_index': 2, 'physical_start': 11, 'candidate': 17, 'address': 3, 'directory_entry': 27}), ({'w': 11, 'h': 10, 'x': 9, 'y': 6, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 34, 'local_index': 9, 'physical_start': 45, 'candidate': 65, 'address': 65, 'directory_entry': 31})], 2: [({'w': 11, 'h': 11, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 50, 'local_index': 0, 'physical_start': 22, 'candidate': 24, 'address': 6, 'directory_entry': 22}), ({'w': 12, 'h': 11, 'x': 5, 'y': 1, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 50, 'local_index': 5, 'physical_start': 172, 'candidate': 189, 'address': 189, 'directory_entry': 26}), ({'w': 11, 'h': 11, 'x': 8, 'y': 2, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 50, 'local_index': 8, 'physical_start': 22, 'candidate': 48, 'address': 48, 'directory_entry': 30}), ({'w': 12, 'h': 11, 'x': 1, 'y': 5, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 3, 'slot': 2, 'resident': True, 'slot_pitch': 50, 'local_index': 5, 'physical_start': 122, 'candidate': 139, 'address': 139, 'directory_entry': 34}), ({'w': 11, 'h': 11, 'x': 6, 'y': 4, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 50, 'local_index': 2, 'physical_start': 22, 'candidate': 30, 'address': 6, 'directory_entry': 38}), ({'w': 12, 'h': 11, 'x': 9, 'y': 6, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 50, 'local_index': 9, 'physical_start': 72, 'candidate': 101, 'address': 101, 'directory_entry': 42})], 3: [({'w': 12, 'h': 12, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 0, 'physical_start': 33, 'candidate': 35, 'address': 9, 'directory_entry': 33}), ({'w': 13, 'h': 12, 'x': 5, 'y': 1, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 66, 'local_index': 5, 'physical_start': 231, 'candidate': 253, 'address': 253, 'directory_entry': 37}), ({'w': 12, 'h': 12, 'x': 8, 'y': 2, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 66, 'local_index': 8, 'physical_start': 33, 'candidate': 67, 'address': 67, 'directory_entry': 41}), ({'w': 13, 'h': 12, 'x': 1, 'y': 5, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 5, 'physical_start': 33, 'candidate': 55, 'address': 9, 'directory_entry': 49}), ({'w': 12, 'h': 12, 'x': 6, 'y': 4, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 2, 'physical_start': 33, 'candidate': 43, 'address': 9, 'directory_entry': 49}), ({'w': 13, 'h': 12, 'x': 9, 'y': 6, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 66, 'local_index': 9, 'physical_start': 363, 'candidate': 401, 'address': 401, 'directory_entry': 57})], 4: [({'w': 13, 'h': 13, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 82, 'local_index': 0, 'physical_start': 44, 'candidate': 46, 'address': 12, 'directory_entry': 44}), ({'w': 14, 'h': 13, 'x': 5, 'y': 1, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 82, 'local_index': 5, 'physical_start': 290, 'candidate': 317, 'address': 317, 'directory_entry': 48}), ({'w': 13, 'h': 13, 'x': 8, 'y': 2, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 82, 'local_index': 8, 'physical_start': 44, 'candidate': 86, 'address': 86, 'directory_entry': 52}), ({'w': 14, 'h': 13, 'x': 1, 'y': 5, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 82, 'local_index': 5, 'physical_start': 44, 'candidate': 71, 'address': 12, 'directory_entry': 60}), ({'w': 13, 'h': 13, 'x': 6, 'y': 4, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 82, 'local_index': 2, 'physical_start': 126, 'candidate': 138, 'address': 138, 'directory_entry': 64}), ({'w': 14, 'h': 13, 'x': 9, 'y': 6, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 82, 'local_index': 9, 'physical_start': 454, 'candidate': 501, 'address': 501, 'directory_entry': 68})], 5: [({'w': 14, 'h': 14, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 98, 'local_index': 0, 'physical_start': 55, 'candidate': 57, 'address': 15, 'directory_entry': 55}), ({'w': 15, 'h': 14, 'x': 5, 'y': 1, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 98, 'local_index': 5, 'physical_start': 349, 'candidate': 381, 'address': 381, 'directory_entry': 59}), ({'w': 14, 'h': 14, 'x': 8, 'y': 2, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 98, 'local_index': 8, 'physical_start': 55, 'candidate': 105, 'address': 105, 'directory_entry': 63}), ({'w': 15, 'h': 14, 'x': 1, 'y': 5, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 98, 'local_index': 5, 'physical_start': 55, 'candidate': 87, 'address': 15, 'directory_entry': 71}), ({'w': 14, 'h': 14, 'x': 6, 'y': 4, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 98, 'local_index': 2, 'physical_start': 153, 'candidate': 167, 'address': 167, 'directory_entry': 75}), ({'w': 15, 'h': 14, 'x': 9, 'y': 6, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 98, 'local_index': 9, 'physical_start': 545, 'candidate': 601, 'address': 601, 'directory_entry': 79})]}
for i, (p, expected) in enumerate(cases[N]):
check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| layout fixture 1 | {'address': 3, 'candidate': 13, 'directory_entry': 11, 'local_index': 0, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 0} | {'address': 3, 'candidate': 13, 'directory_entry': 11, 'local_index': 0, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 0} | Passed |
| layout fixture 2 | {'address': 125, 'candidate': 125, 'directory_entry': 15, 'local_index': 5, 'physical_start': 113, 'resident': True, 'slot': 3, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 1} | {'address': 125, 'candidate': 125, 'directory_entry': 15, 'local_index': 5, 'physical_start': 113, 'resident': True, 'slot': 3, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 1} | Passed |
| layout fixture 3 | {'address': 3, 'candidate': 29, 'directory_entry': 19, 'local_index': 8, 'physical_start': 11, 'resident': False, 'slot': 0, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 2} | {'address': 29, 'candidate': 29, 'directory_entry': 19, 'local_index': 8, 'physical_start': 11, 'resident': True, 'slot': 0, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 2} | Failed |
| layout fixture 4 | {'address': 91, 'candidate': 91, 'directory_entry': 23, 'local_index': 5, 'physical_start': 79, 'resident': True, 'slot': 2, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 3} | {'address': 91, 'candidate': 91, 'directory_entry': 23, 'local_index': 5, 'physical_start': 79, 'resident': True, 'slot': 2, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 3} | Passed |
| layout fixture 5 | {'address': 3, 'candidate': 17, 'directory_entry': 27, 'local_index': 2, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 4} | {'address': 3, 'candidate': 17, 'directory_entry': 27, 'local_index': 2, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 4} | Passed |
| layout fixture 6 | {'address': 65, 'candidate': 65, 'directory_entry': 31, 'local_index': 9, 'physical_start': 45, 'resident': True, 'slot': 1, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 5} | {'address': 65, 'candidate': 65, 'directory_entry': 31, 'local_index': 9, 'physical_start': 45, 'resident': True, 'slot': 1, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 5} | Passed |
SHA-256 / de1e5fdfecafca7ae9c665b006fcaa096cacdf1ff5aed09fd15d44f7eeb51ea7
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(p):
p = dict(p)
tile_columns = (p["w"]+3)//4
virtual_id = (p["y"]//4)*tile_columns+p["x"]//4
slot = p["slots"][virtual_id]
resident = True
slot_pitch = 16*p["b"]+2
local_index = (p["y"]%4)*4+p["x"]%4
physical_start = p["base"]+(slot if slot is not None else 0)*slot_pitch
candidate = physical_start+2+local_index*p["b"]
address = candidate if resident else p["fallback"]
directory_entry = p["base"]+virtual_id*4
return {'tile_columns': tile_columns, 'virtual_id': virtual_id, 'slot': slot, 'resident': resident, 'slot_pitch': slot_pitch, 'local_index': local_index, 'physical_start': physical_start, 'candidate': candidate, 'address': address, 'directory_entry': directory_entry}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 10, 'h': 10, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 34, 'local_index': 0, 'physical_start': 11, 'candidate': 13, 'address': 3, 'directory_entry': 11}), ({'w': 11, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 34, 'local_index': 5, 'physical_start': 113, 'candidate': 125, 'address': 125, 'directory_entry': 15}), ({'w': 10, 'h': 10, 'x': 8, 'y': 2, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 34, 'local_index': 8, 'physical_start': 11, 'candidate': 29, 'address': 29, 'directory_entry': 19}), ({'w': 11, 'h': 10, 'x': 1, 'y': 5, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 3, 'slot': 2, 'resident': True, 'slot_pitch': 34, 'local_index': 5, 'physical_start': 79, 'candidate': 91, 'address': 91, 'directory_entry': 23}), ({'w': 10, 'h': 10, 'x': 6, 'y': 4, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 34, 'local_index': 2, 'physical_start': 11, 'candidate': 17, 'address': 3, 'directory_entry': 27}), ({'w': 11, 'h': 10, 'x': 9, 'y': 6, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 34, 'local_index': 9, 'physical_start': 45, 'candidate': 65, 'address': 65, 'directory_entry': 31})], 2: [({'w': 11, 'h': 11, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 50, 'local_index': 0, 'physical_start': 22, 'candidate': 24, 'address': 6, 'directory_entry': 22}), ({'w': 12, 'h': 11, 'x': 5, 'y': 1, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 50, 'local_index': 5, 'physical_start': 172, 'candidate': 189, 'address': 189, 'directory_entry': 26}), ({'w': 11, 'h': 11, 'x': 8, 'y': 2, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 50, 'local_index': 8, 'physical_start': 22, 'candidate': 48, 'address': 48, 'directory_entry': 30}), ({'w': 12, 'h': 11, 'x': 1, 'y': 5, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 3, 'slot': 2, 'resident': True, 'slot_pitch': 50, 'local_index': 5, 'physical_start': 122, 'candidate': 139, 'address': 139, 'directory_entry': 34}), ({'w': 11, 'h': 11, 'x': 6, 'y': 4, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 50, 'local_index': 2, 'physical_start': 22, 'candidate': 30, 'address': 6, 'directory_entry': 38}), ({'w': 12, 'h': 11, 'x': 9, 'y': 6, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 50, 'local_index': 9, 'physical_start': 72, 'candidate': 101, 'address': 101, 'directory_entry': 42})], 3: [({'w': 12, 'h': 12, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 0, 'physical_start': 33, 'candidate': 35, 'address': 9, 'directory_entry': 33}), ({'w': 13, 'h': 12, 'x': 5, 'y': 1, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 66, 'local_index': 5, 'physical_start': 231, 'candidate': 253, 'address': 253, 'directory_entry': 37}), ({'w': 12, 'h': 12, 'x': 8, 'y': 2, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 66, 'local_index': 8, 'physical_start': 33, 'candidate': 67, 'address': 67, 'directory_entry': 41}), ({'w': 13, 'h': 12, 'x': 1, 'y': 5, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 5, 'physical_start': 33, 'candidate': 55, 'address': 9, 'directory_entry': 49}), ({'w': 12, 'h': 12, 'x': 6, 'y': 4, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 2, 'physical_start': 33, 'candidate': 43, 'address': 9, 'directory_entry': 49}), ({'w': 13, 'h': 12, 'x': 9, 'y': 6, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 66, 'local_index': 9, 'physical_start': 363, 'candidate': 401, 'address': 401, 'directory_entry': 57})], 4: [({'w': 13, 'h': 13, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 82, 'local_index': 0, 'physical_start': 44, 'candidate': 46, 'address': 12, 'directory_entry': 44}), ({'w': 14, 'h': 13, 'x': 5, 'y': 1, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 82, 'local_index': 5, 'physical_start': 290, 'candidate': 317, 'address': 317, 'directory_entry': 48}), ({'w': 13, 'h': 13, 'x': 8, 'y': 2, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 82, 'local_index': 8, 'physical_start': 44, 'candidate': 86, 'address': 86, 'directory_entry': 52}), ({'w': 14, 'h': 13, 'x': 1, 'y': 5, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 82, 'local_index': 5, 'physical_start': 44, 'candidate': 71, 'address': 12, 'directory_entry': 60}), ({'w': 13, 'h': 13, 'x': 6, 'y': 4, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 82, 'local_index': 2, 'physical_start': 126, 'candidate': 138, 'address': 138, 'directory_entry': 64}), ({'w': 14, 'h': 13, 'x': 9, 'y': 6, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 82, 'local_index': 9, 'physical_start': 454, 'candidate': 501, 'address': 501, 'directory_entry': 68})], 5: [({'w': 14, 'h': 14, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 98, 'local_index': 0, 'physical_start': 55, 'candidate': 57, 'address': 15, 'directory_entry': 55}), ({'w': 15, 'h': 14, 'x': 5, 'y': 1, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 98, 'local_index': 5, 'physical_start': 349, 'candidate': 381, 'address': 381, 'directory_entry': 59}), ({'w': 14, 'h': 14, 'x': 8, 'y': 2, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 98, 'local_index': 8, 'physical_start': 55, 'candidate': 105, 'address': 105, 'directory_entry': 63}), ({'w': 15, 'h': 14, 'x': 1, 'y': 5, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 98, 'local_index': 5, 'physical_start': 55, 'candidate': 87, 'address': 15, 'directory_entry': 71}), ({'w': 14, 'h': 14, 'x': 6, 'y': 4, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 98, 'local_index': 2, 'physical_start': 153, 'candidate': 167, 'address': 167, 'directory_entry': 75}), ({'w': 15, 'h': 14, 'x': 9, 'y': 6, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 98, 'local_index': 9, 'physical_start': 545, 'candidate': 601, 'address': 601, 'directory_entry': 79})]}
for i, (p, expected) in enumerate(cases[N]):
check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| layout fixture 1 | {'address': 13, 'candidate': 13, 'directory_entry': 11, 'local_index': 0, 'physical_start': 11, 'resident': True, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 0} | {'address': 3, 'candidate': 13, 'directory_entry': 11, 'local_index': 0, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 0} | Failed |
| layout fixture 2 | {'address': 125, 'candidate': 125, 'directory_entry': 15, 'local_index': 5, 'physical_start': 113, 'resident': True, 'slot': 3, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 1} | {'address': 125, 'candidate': 125, 'directory_entry': 15, 'local_index': 5, 'physical_start': 113, 'resident': True, 'slot': 3, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 1} | Passed |
| layout fixture 3 | {'address': 29, 'candidate': 29, 'directory_entry': 19, 'local_index': 8, 'physical_start': 11, 'resident': True, 'slot': 0, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 2} | {'address': 29, 'candidate': 29, 'directory_entry': 19, 'local_index': 8, 'physical_start': 11, 'resident': True, 'slot': 0, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 2} | Passed |
| layout fixture 4 | {'address': 91, 'candidate': 91, 'directory_entry': 23, 'local_index': 5, 'physical_start': 79, 'resident': True, 'slot': 2, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 3} | {'address': 91, 'candidate': 91, 'directory_entry': 23, 'local_index': 5, 'physical_start': 79, 'resident': True, 'slot': 2, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 3} | Passed |
| layout fixture 5 | {'address': 17, 'candidate': 17, 'directory_entry': 27, 'local_index': 2, 'physical_start': 11, 'resident': True, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 4} | {'address': 3, 'candidate': 17, 'directory_entry': 27, 'local_index': 2, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 4} | Failed |
| layout fixture 6 | {'address': 65, 'candidate': 65, 'directory_entry': 31, 'local_index': 9, 'physical_start': 45, 'resident': True, 'slot': 1, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 5} | {'address': 65, 'candidate': 65, 'directory_entry': 31, 'local_index': 9, 'physical_start': 45, 'resident': True, 'slot': 1, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 5} | Passed |
SHA-256 / f896f5ae6f03f78d0b0adae0bc868108cb0c6c54b0793d9264491e0a3e32435b
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(p):
p = dict(p)
tile_columns = (p["w"]+3)//4
virtual_id = (p["y"]//4)*tile_columns+p["x"]//4
slot = p["slots"][virtual_id]
resident = slot is not None
slot_pitch = 16*p["b"]+2
local_index = (p["y"]%4)*4+p["x"]%4
physical_start = p["base"]+(slot if slot is not None else 0)*slot_pitch
candidate = physical_start+2+local_index*p["b"]
address = candidate if resident else p["fallback"]
directory_entry = p["base"]+virtual_id*4
return {'tile_columns': tile_columns, 'virtual_id': virtual_id, 'slot': slot, 'resident': resident, 'slot_pitch': slot_pitch, 'local_index': local_index, 'physical_start': physical_start, 'candidate': candidate, 'address': address, 'directory_entry': directory_entry}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {1: [({'w': 10, 'h': 10, 'x': 0, 'y': 0, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 34, 'local_index': 0, 'physical_start': 11, 'candidate': 13, 'address': 3, 'directory_entry': 11}), ({'w': 11, 'h': 10, 'x': 5, 'y': 1, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 34, 'local_index': 5, 'physical_start': 113, 'candidate': 125, 'address': 125, 'directory_entry': 15}), ({'w': 10, 'h': 10, 'x': 8, 'y': 2, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 34, 'local_index': 8, 'physical_start': 11, 'candidate': 29, 'address': 29, 'directory_entry': 19}), ({'w': 11, 'h': 10, 'x': 1, 'y': 5, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 3, 'slot': 2, 'resident': True, 'slot_pitch': 34, 'local_index': 5, 'physical_start': 79, 'candidate': 91, 'address': 91, 'directory_entry': 23}), ({'w': 10, 'h': 10, 'x': 6, 'y': 4, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 34, 'local_index': 2, 'physical_start': 11, 'candidate': 17, 'address': 3, 'directory_entry': 27}), ({'w': 11, 'h': 10, 'x': 9, 'y': 6, 'b': 2, 'base': 11, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 3}, {'tile_columns': 3, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 34, 'local_index': 9, 'physical_start': 45, 'candidate': 65, 'address': 65, 'directory_entry': 31})], 2: [({'w': 11, 'h': 11, 'x': 0, 'y': 0, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 50, 'local_index': 0, 'physical_start': 22, 'candidate': 24, 'address': 6, 'directory_entry': 22}), ({'w': 12, 'h': 11, 'x': 5, 'y': 1, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 50, 'local_index': 5, 'physical_start': 172, 'candidate': 189, 'address': 189, 'directory_entry': 26}), ({'w': 11, 'h': 11, 'x': 8, 'y': 2, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 50, 'local_index': 8, 'physical_start': 22, 'candidate': 48, 'address': 48, 'directory_entry': 30}), ({'w': 12, 'h': 11, 'x': 1, 'y': 5, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 3, 'slot': 2, 'resident': True, 'slot_pitch': 50, 'local_index': 5, 'physical_start': 122, 'candidate': 139, 'address': 139, 'directory_entry': 34}), ({'w': 11, 'h': 11, 'x': 6, 'y': 4, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 50, 'local_index': 2, 'physical_start': 22, 'candidate': 30, 'address': 6, 'directory_entry': 38}), ({'w': 12, 'h': 11, 'x': 9, 'y': 6, 'b': 3, 'base': 22, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 6}, {'tile_columns': 3, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 50, 'local_index': 9, 'physical_start': 72, 'candidate': 101, 'address': 101, 'directory_entry': 42})], 3: [({'w': 12, 'h': 12, 'x': 0, 'y': 0, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 0, 'physical_start': 33, 'candidate': 35, 'address': 9, 'directory_entry': 33}), ({'w': 13, 'h': 12, 'x': 5, 'y': 1, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 66, 'local_index': 5, 'physical_start': 231, 'candidate': 253, 'address': 253, 'directory_entry': 37}), ({'w': 12, 'h': 12, 'x': 8, 'y': 2, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 66, 'local_index': 8, 'physical_start': 33, 'candidate': 67, 'address': 67, 'directory_entry': 41}), ({'w': 13, 'h': 12, 'x': 1, 'y': 5, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 5, 'physical_start': 33, 'candidate': 55, 'address': 9, 'directory_entry': 49}), ({'w': 12, 'h': 12, 'x': 6, 'y': 4, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 3, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 66, 'local_index': 2, 'physical_start': 33, 'candidate': 43, 'address': 9, 'directory_entry': 49}), ({'w': 13, 'h': 12, 'x': 9, 'y': 6, 'b': 4, 'base': 33, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 9}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 66, 'local_index': 9, 'physical_start': 363, 'candidate': 401, 'address': 401, 'directory_entry': 57})], 4: [({'w': 13, 'h': 13, 'x': 0, 'y': 0, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 82, 'local_index': 0, 'physical_start': 44, 'candidate': 46, 'address': 12, 'directory_entry': 44}), ({'w': 14, 'h': 13, 'x': 5, 'y': 1, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 82, 'local_index': 5, 'physical_start': 290, 'candidate': 317, 'address': 317, 'directory_entry': 48}), ({'w': 13, 'h': 13, 'x': 8, 'y': 2, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 82, 'local_index': 8, 'physical_start': 44, 'candidate': 86, 'address': 86, 'directory_entry': 52}), ({'w': 14, 'h': 13, 'x': 1, 'y': 5, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 82, 'local_index': 5, 'physical_start': 44, 'candidate': 71, 'address': 12, 'directory_entry': 60}), ({'w': 13, 'h': 13, 'x': 6, 'y': 4, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 82, 'local_index': 2, 'physical_start': 126, 'candidate': 138, 'address': 138, 'directory_entry': 64}), ({'w': 14, 'h': 13, 'x': 9, 'y': 6, 'b': 5, 'base': 44, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 12}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 82, 'local_index': 9, 'physical_start': 454, 'candidate': 501, 'address': 501, 'directory_entry': 68})], 5: [({'w': 14, 'h': 14, 'x': 0, 'y': 0, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 0, 'slot': None, 'resident': False, 'slot_pitch': 98, 'local_index': 0, 'physical_start': 55, 'candidate': 57, 'address': 15, 'directory_entry': 55}), ({'w': 15, 'h': 14, 'x': 5, 'y': 1, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 1, 'slot': 3, 'resident': True, 'slot_pitch': 98, 'local_index': 5, 'physical_start': 349, 'candidate': 381, 'address': 381, 'directory_entry': 59}), ({'w': 14, 'h': 14, 'x': 8, 'y': 2, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 2, 'slot': 0, 'resident': True, 'slot_pitch': 98, 'local_index': 8, 'physical_start': 55, 'candidate': 105, 'address': 105, 'directory_entry': 63}), ({'w': 15, 'h': 14, 'x': 1, 'y': 5, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 4, 'slot': None, 'resident': False, 'slot_pitch': 98, 'local_index': 5, 'physical_start': 55, 'candidate': 87, 'address': 15, 'directory_entry': 71}), ({'w': 14, 'h': 14, 'x': 6, 'y': 4, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 5, 'slot': 1, 'resident': True, 'slot_pitch': 98, 'local_index': 2, 'physical_start': 153, 'candidate': 167, 'address': 167, 'directory_entry': 75}), ({'w': 15, 'h': 14, 'x': 9, 'y': 6, 'b': 6, 'base': 55, 'slots': [None, 3, 0, 2, None, 1, 5, 4, None, 6, 7, 8, 9, 10, 11, 12, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63], 'fallback': 15}, {'tile_columns': 4, 'virtual_id': 6, 'slot': 5, 'resident': True, 'slot_pitch': 98, 'local_index': 9, 'physical_start': 545, 'candidate': 601, 'address': 601, 'directory_entry': 79})]}
for i, (p, expected) in enumerate(cases[N]):
check("layout fixture " + str(i + 1), solve(p), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| layout fixture 1 | {'address': 3, 'candidate': 13, 'directory_entry': 11, 'local_index': 0, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 0} | {'address': 3, 'candidate': 13, 'directory_entry': 11, 'local_index': 0, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 0} | Passed |
| layout fixture 2 | {'address': 125, 'candidate': 125, 'directory_entry': 15, 'local_index': 5, 'physical_start': 113, 'resident': True, 'slot': 3, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 1} | {'address': 125, 'candidate': 125, 'directory_entry': 15, 'local_index': 5, 'physical_start': 113, 'resident': True, 'slot': 3, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 1} | Passed |
| layout fixture 3 | {'address': 29, 'candidate': 29, 'directory_entry': 19, 'local_index': 8, 'physical_start': 11, 'resident': True, 'slot': 0, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 2} | {'address': 29, 'candidate': 29, 'directory_entry': 19, 'local_index': 8, 'physical_start': 11, 'resident': True, 'slot': 0, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 2} | Passed |
| layout fixture 4 | {'address': 91, 'candidate': 91, 'directory_entry': 23, 'local_index': 5, 'physical_start': 79, 'resident': True, 'slot': 2, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 3} | {'address': 91, 'candidate': 91, 'directory_entry': 23, 'local_index': 5, 'physical_start': 79, 'resident': True, 'slot': 2, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 3} | Passed |
| layout fixture 5 | {'address': 3, 'candidate': 17, 'directory_entry': 27, 'local_index': 2, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 4} | {'address': 3, 'candidate': 17, 'directory_entry': 27, 'local_index': 2, 'physical_start': 11, 'resident': False, 'slot': None, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 4} | Passed |
| layout fixture 6 | {'address': 65, 'candidate': 65, 'directory_entry': 31, 'local_index': 9, 'physical_start': 45, 'resident': True, 'slot': 1, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 5} | {'address': 65, 'candidate': 65, 'directory_entry': 31, 'local_index': 9, 'physical_start': 45, 'resident': True, 'slot': 1, 'slot_pitch': 34, 'tile_columns': 3, 'virtual_id': 5} | Passed |
SHA-256 / 55f42b6dc7993f2d60994eb3b41f1aff40d388adbd43b9de1961c17e1b923141
Verification & scope
Stipulated deterministic toy buffer layout; not a graphics API, codec, GPU vendor tiling specification, or hardware-conformance claim. Inputs satisfy the dimensions and bounds stated by the model. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:45:30.742588+00:00.
Case digest / ec2c42a7271c1c0782f1b8161d93881047ecbdd9cf9352c3425dafeff12dad27