FA-85491 / Ride-hailing fare and surge pricing / Open access
Pickup outside every zone gets a zero multiplier · case 01
Trips starting outside the zone map are priced at zero.
ROOT CAUSE
The default multiplier is 0 instead of 1.0x.
VERIFIED REPAIR
Default to 10 tenths (1.0x).
Unsuccessful approach: Returning 1 confuses multiplier units and prices trips at 0.1x.
Case contract
Surge zones are rectangles, half-open [x0, x1) x [y0, y1). The multiplier comes from the pickup point only. Among zones containing it choose highest priority, then highest multiplier, then lowest id. No containing zone gives [None, 10] (1.0x in tenths). Return [zone id, multiplier].
Why this case matters
Ride-hailing prices are computed per trip at scale; ordering, unit and boundary slips become systematic over- or under-charging.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(zones, pickup, dropoff):
best = None
for z in zones:
if z['x0'] <= pickup[0] < z['x1'] and z['y0'] <= pickup[1] < z['y1']:
k = (z['priority'], z['mult'], -z['id'])
if best is None or k > best[0]:
best = (k, z)
if best is None:
return [None, 0]
return [best[1]['id'], best[1]['mult']]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: no-zone default',
[[{'id': 15, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 43, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20}],
[0, 30], [40, 0]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 17, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 8, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 13, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 31, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 5, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30}],
[40, 20], [20, 0]],
[None, 10]),
('second regression',
[[{'id': 29, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 3, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 7, 'mult': 12, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 10, 'y1': 30},
{'id': 9, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 20}],
[40, 12], [15, 5]],
[None, 10]),
('normal control 1',
[[{'id': 6, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 50, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 12, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20}],
[20, 30], [30, 12]],
[6, 15]),
('normal control 2',
[[{'id': 34, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 41, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 38, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[30, 5], [5, 10]],
[10, 20]),
('normal control 3',
[[{'id': 13, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40},
{'id': 34, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 30, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 14, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 29, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20}],
[10, 20], [40, 30]],
[34, 12]),
('normal control 4',
[[{'id': 14, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 38, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 42, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 39, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20}],
[9, 12], [20, 20]],
[42, 12])],
[('regression: no-zone default',
[[{'id': 14, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 47, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[30, 0], [10, 10]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 44, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 6, 'mult': 12, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 47, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20}],
[30, 0], [30, 10]],
[None, 10]),
('second regression',
[[{'id': 6, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 17, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 40},
{'id': 11, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 34, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 40, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[40, 30], [34, 12]],
[None, 10]),
('normal control 1',
[[{'id': 20, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 37, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 39, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 27, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 46, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20}],
[10, 14], [5, 12]],
[46, 15]),
('normal control 2',
[[{'id': 32, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 50, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 9, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 10},
{'id': 37, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30}],
[10, 0], [40, 30]],
[32, 12]),
('normal control 3',
[[{'id': 50, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40},
{'id': 45, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 20, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20}],
[39, 24], [5, 30]],
[50, 15]),
('normal control 4',
[[{'id': 41, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 12, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 40},
{'id': 48, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 10, 'y1': 30},
{'id': 30, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 35, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40}],
[10, 36], [30, 20]],
[12, 15])],
[('regression: no-zone default',
[[{'id': 44, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 48, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[10, 30], [0, 10]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 19, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 35, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20}],
[20, 0], [22, 12]],
[None, 10]),
('second regression',
[[{'id': 9, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 1, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 50, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 31, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10}],
[10, 5], [10, 4]],
[None, 10]),
('normal control 1',
[[{'id': 13, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 30, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 9, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 12, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10}],
[20, 5], [5, 0]],
[13, 20]),
('normal control 2',
[[{'id': 10, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 39, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 11, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 24, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 15, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30}],
[20, 20], [40, 30]],
[24, 15]),
('normal control 3',
[[{'id': 2, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 19, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 20, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 5, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30}],
[0, 5], [15, 5]],
[2, 20]),
('normal control 4',
[[{'id': 26, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 27, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 20, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 33, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30}],
[30, 0], [30, 12]],
[33, 15])],
[('regression: no-zone default',
[[{'id': 26, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30}], [0, 10], [10, 5]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 8, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 26, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30}],
[10, 10], [30, 30]],
[None, 10]),
('second regression',
[[{'id': 26, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 46, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 18, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 49, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 48, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10}],
[40, 20], [40, 5]],
[None, 10]),
('normal control 1',
[[{'id': 46, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 15, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 2, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 40}],
[10, 30], [15, 30]],
[2, 15]),
('normal control 2',
[[{'id': 44, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 43, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 21, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 22, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 40},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20}],
[20, 0], [30, 0]],
[10, 20]),
('normal control 3',
[[{'id': 38, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 14, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 7, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[20, 10], [30, 0]],
[7, 20]),
('normal control 4',
[[{'id': 49, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 35, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 21, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 43, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 36, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20}],
[30, 10], [5, 5]],
[49, 15])],
[('regression: no-zone default',
[[{'id': 18, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 32, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 19, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 22, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30}],
[40, 12], [30, 5]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 47, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40}], [30, 12], [15, 10]],
[None, 10]),
('second regression',
[[{'id': 20, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10}], [20, 20], [5, 30]],
[None, 10]),
('normal control 1',
[[{'id': 37, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 3, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 2, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[0, 12], [0, 5]],
[3, 20]),
('normal control 2',
[[{'id': 40, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 30},
{'id': 45, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 20}],
[25, 12], [0, 30]],
[40, 20]),
('normal control 3',
[[{'id': 17, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 8, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 3, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 11, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[10, 10], [40, 30]],
[10, 20]),
('normal control 4',
[[{'id': 10, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 37, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 25, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 40},
{'id': 26, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30}],
[38, 20], [20, 20]],
[26, 20])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), 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 |
|---|---|---|---|
| regression: no-zone default | [None, 0] | [None, 10] | Failed |
| partial repair probe: no-zone default | [None, 0] | [None, 10] | Failed |
| second regression | [None, 0] | [None, 10] | Failed |
| normal control 1 | [6, 15] | [6, 15] | Passed |
| normal control 2 | [10, 20] | [10, 20] | Passed |
| normal control 3 | [34, 12] | [34, 12] | Passed |
| normal control 4 | [42, 12] | [42, 12] | Passed |
SHA-256 / 1a08b373061461ee0e11ff2478d599f9af8ebf6359012255484c4dc0d7de436a
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(zones, pickup, dropoff):
best = None
for z in zones:
if z['x0'] <= pickup[0] < z['x1'] and z['y0'] <= pickup[1] < z['y1']:
k = (z['priority'], z['mult'], -z['id'])
if best is None or k > best[0]:
best = (k, z)
if best is None:
return [None, 1]
return [best[1]['id'], best[1]['mult']]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: no-zone default',
[[{'id': 15, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 43, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20}],
[0, 30], [40, 0]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 17, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 8, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 13, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 31, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 5, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30}],
[40, 20], [20, 0]],
[None, 10]),
('second regression',
[[{'id': 29, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 3, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 7, 'mult': 12, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 10, 'y1': 30},
{'id': 9, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 20}],
[40, 12], [15, 5]],
[None, 10]),
('normal control 1',
[[{'id': 6, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 50, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 12, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20}],
[20, 30], [30, 12]],
[6, 15]),
('normal control 2',
[[{'id': 34, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 41, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 38, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[30, 5], [5, 10]],
[10, 20]),
('normal control 3',
[[{'id': 13, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40},
{'id': 34, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 30, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 14, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 29, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20}],
[10, 20], [40, 30]],
[34, 12]),
('normal control 4',
[[{'id': 14, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 38, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 42, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 39, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20}],
[9, 12], [20, 20]],
[42, 12])],
[('regression: no-zone default',
[[{'id': 14, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 47, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[30, 0], [10, 10]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 44, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 6, 'mult': 12, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 47, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20}],
[30, 0], [30, 10]],
[None, 10]),
('second regression',
[[{'id': 6, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 17, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 40},
{'id': 11, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 34, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 40, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[40, 30], [34, 12]],
[None, 10]),
('normal control 1',
[[{'id': 20, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 37, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 39, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 27, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 46, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20}],
[10, 14], [5, 12]],
[46, 15]),
('normal control 2',
[[{'id': 32, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 50, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 9, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 10},
{'id': 37, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30}],
[10, 0], [40, 30]],
[32, 12]),
('normal control 3',
[[{'id': 50, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40},
{'id': 45, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 20, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20}],
[39, 24], [5, 30]],
[50, 15]),
('normal control 4',
[[{'id': 41, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 12, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 40},
{'id': 48, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 10, 'y1': 30},
{'id': 30, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 35, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40}],
[10, 36], [30, 20]],
[12, 15])],
[('regression: no-zone default',
[[{'id': 44, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 48, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[10, 30], [0, 10]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 19, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 35, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20}],
[20, 0], [22, 12]],
[None, 10]),
('second regression',
[[{'id': 9, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 1, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 50, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 31, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10}],
[10, 5], [10, 4]],
[None, 10]),
('normal control 1',
[[{'id': 13, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 30, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 9, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 12, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10}],
[20, 5], [5, 0]],
[13, 20]),
('normal control 2',
[[{'id': 10, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 39, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 11, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 24, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 15, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30}],
[20, 20], [40, 30]],
[24, 15]),
('normal control 3',
[[{'id': 2, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 19, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 20, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 5, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30}],
[0, 5], [15, 5]],
[2, 20]),
('normal control 4',
[[{'id': 26, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 27, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 20, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 33, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30}],
[30, 0], [30, 12]],
[33, 15])],
[('regression: no-zone default',
[[{'id': 26, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30}], [0, 10], [10, 5]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 8, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 26, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30}],
[10, 10], [30, 30]],
[None, 10]),
('second regression',
[[{'id': 26, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 46, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 18, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 49, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 48, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10}],
[40, 20], [40, 5]],
[None, 10]),
('normal control 1',
[[{'id': 46, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 15, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 2, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 40}],
[10, 30], [15, 30]],
[2, 15]),
('normal control 2',
[[{'id': 44, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 43, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 21, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 22, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 40},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20}],
[20, 0], [30, 0]],
[10, 20]),
('normal control 3',
[[{'id': 38, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 14, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 7, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[20, 10], [30, 0]],
[7, 20]),
('normal control 4',
[[{'id': 49, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 35, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 21, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 43, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 36, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20}],
[30, 10], [5, 5]],
[49, 15])],
[('regression: no-zone default',
[[{'id': 18, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 32, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 19, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 22, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30}],
[40, 12], [30, 5]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 47, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40}], [30, 12], [15, 10]],
[None, 10]),
('second regression',
[[{'id': 20, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10}], [20, 20], [5, 30]],
[None, 10]),
('normal control 1',
[[{'id': 37, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 3, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 2, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[0, 12], [0, 5]],
[3, 20]),
('normal control 2',
[[{'id': 40, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 30},
{'id': 45, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 20}],
[25, 12], [0, 30]],
[40, 20]),
('normal control 3',
[[{'id': 17, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 8, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 3, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 11, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[10, 10], [40, 30]],
[10, 20]),
('normal control 4',
[[{'id': 10, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 37, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 25, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 40},
{'id': 26, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30}],
[38, 20], [20, 20]],
[26, 20])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), 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 |
|---|---|---|---|
| regression: no-zone default | [None, 1] | [None, 10] | Failed |
| partial repair probe: no-zone default | [None, 1] | [None, 10] | Failed |
| second regression | [None, 1] | [None, 10] | Failed |
| normal control 1 | [6, 15] | [6, 15] | Passed |
| normal control 2 | [10, 20] | [10, 20] | Passed |
| normal control 3 | [34, 12] | [34, 12] | Passed |
| normal control 4 | [42, 12] | [42, 12] | Passed |
SHA-256 / 3b0dfde47663112b440fdf0b132283e843a012a7df3168f6e218458c24e9d2a7
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(zones, pickup, dropoff):
best = None
for z in zones:
if z['x0'] <= pickup[0] < z['x1'] and z['y0'] <= pickup[1] < z['y1']:
k = (z['priority'], z['mult'], -z['id'])
if best is None or k > best[0]:
best = (k, z)
if best is None:
return [None, 10]
return [best[1]['id'], best[1]['mult']]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: no-zone default',
[[{'id': 15, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 43, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20}],
[0, 30], [40, 0]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 17, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 8, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 13, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 31, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 5, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30}],
[40, 20], [20, 0]],
[None, 10]),
('second regression',
[[{'id': 29, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 3, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 7, 'mult': 12, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 10, 'y1': 30},
{'id': 9, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 20}],
[40, 12], [15, 5]],
[None, 10]),
('normal control 1',
[[{'id': 6, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 50, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 12, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20}],
[20, 30], [30, 12]],
[6, 15]),
('normal control 2',
[[{'id': 34, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 41, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 38, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[30, 5], [5, 10]],
[10, 20]),
('normal control 3',
[[{'id': 13, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40},
{'id': 34, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 30, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 14, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 29, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20}],
[10, 20], [40, 30]],
[34, 12]),
('normal control 4',
[[{'id': 14, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 38, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 42, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 39, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20}],
[9, 12], [20, 20]],
[42, 12])],
[('regression: no-zone default',
[[{'id': 14, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 47, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[30, 0], [10, 10]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 44, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 6, 'mult': 12, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 47, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20}],
[30, 0], [30, 10]],
[None, 10]),
('second regression',
[[{'id': 6, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 17, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 40},
{'id': 11, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 34, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 40, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[40, 30], [34, 12]],
[None, 10]),
('normal control 1',
[[{'id': 20, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 37, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 39, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30},
{'id': 27, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 46, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20}],
[10, 14], [5, 12]],
[46, 15]),
('normal control 2',
[[{'id': 32, 'mult': 12, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 50, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 9, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 10},
{'id': 37, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30}],
[10, 0], [40, 30]],
[32, 12]),
('normal control 3',
[[{'id': 50, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40},
{'id': 45, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 20, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20}],
[39, 24], [5, 30]],
[50, 15]),
('normal control 4',
[[{'id': 41, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 12, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 40},
{'id': 48, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 10, 'y1': 30},
{'id': 30, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 35, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40}],
[10, 36], [30, 20]],
[12, 15])],
[('regression: no-zone default',
[[{'id': 44, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 48, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10}],
[10, 30], [0, 10]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 19, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 35, 'mult': 12, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20}],
[20, 0], [22, 12]],
[None, 10]),
('second regression',
[[{'id': 9, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 1, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 50, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 30},
{'id': 31, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10}],
[10, 5], [10, 4]],
[None, 10]),
('normal control 1',
[[{'id': 13, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 30, 'mult': 20, 'priority': 2, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 9, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 12, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10}],
[20, 5], [5, 0]],
[13, 20]),
('normal control 2',
[[{'id': 10, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 39, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 11, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 24, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 15, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30}],
[20, 20], [40, 30]],
[24, 15]),
('normal control 3',
[[{'id': 2, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 19, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 20, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 5, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30}],
[0, 5], [15, 5]],
[2, 20]),
('normal control 4',
[[{'id': 26, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 27, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 20, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 33, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 49, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30}],
[30, 0], [30, 12]],
[33, 15])],
[('regression: no-zone default',
[[{'id': 26, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30}], [0, 10], [10, 5]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 8, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 26, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30}],
[10, 10], [30, 30]],
[None, 10]),
('second regression',
[[{'id': 26, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 46, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 20},
{'id': 18, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 49, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 48, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10}],
[40, 20], [40, 5]],
[None, 10]),
('normal control 1',
[[{'id': 46, 'mult': 12, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 10},
{'id': 15, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 2, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 20, 'y1': 40}],
[10, 30], [15, 30]],
[2, 15]),
('normal control 2',
[[{'id': 44, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 43, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 21, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 22, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 20, 'y1': 40},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 20}],
[20, 0], [30, 0]],
[10, 20]),
('normal control 3',
[[{'id': 38, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 14, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 0, 'y1': 20},
{'id': 7, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[20, 10], [30, 0]],
[7, 20]),
('normal control 4',
[[{'id': 49, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 35, 'mult': 15, 'priority': 2, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 21, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 0, 'y1': 10},
{'id': 43, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 30},
{'id': 36, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20}],
[30, 10], [5, 5]],
[49, 15])],
[('regression: no-zone default',
[[{'id': 18, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 20},
{'id': 32, 'mult': 15, 'priority': 2, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20},
{'id': 19, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 0, 'y1': 20},
{'id': 22, 'mult': 12, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 30}],
[40, 12], [30, 5]],
[None, 10]),
('partial repair probe: no-zone default',
[[{'id': 47, 'mult': 20, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 40}], [30, 12], [15, 10]],
[None, 10]),
('second regression',
[[{'id': 20, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 10}], [20, 20], [5, 30]],
[None, 10]),
('normal control 1',
[[{'id': 37, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 3, 'mult': 20, 'priority': 2, 'x0': 0, 'x1': 10, 'y0': 0, 'y1': 20},
{'id': 2, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[0, 12], [0, 5]],
[3, 20]),
('normal control 2',
[[{'id': 40, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 30},
{'id': 45, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 0, 'y1': 10},
{'id': 6, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 40, 'y0': 10, 'y1': 30},
{'id': 49, 'mult': 15, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 0, 'y1': 20}],
[25, 12], [0, 30]],
[40, 20]),
('normal control 3',
[[{'id': 17, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 10, 'mult': 20, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 30},
{'id': 8, 'mult': 15, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 30},
{'id': 3, 'mult': 15, 'priority': 1, 'x0': 10, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 11, 'mult': 12, 'priority': 1, 'x0': 20, 'x1': 30, 'y0': 10, 'y1': 20}],
[10, 10], [40, 30]],
[10, 20]),
('normal control 4',
[[{'id': 10, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 20, 'y0': 10, 'y1': 20},
{'id': 37, 'mult': 15, 'priority': 2, 'x0': 10, 'x1': 30, 'y0': 20, 'y1': 40},
{'id': 25, 'mult': 20, 'priority': 1, 'x0': 0, 'x1': 10, 'y0': 20, 'y1': 40},
{'id': 26, 'mult': 20, 'priority': 2, 'x0': 20, 'x1': 40, 'y0': 20, 'y1': 30}],
[38, 20], [20, 20]],
[26, 20])]]
for label, args, expected in fixtures[N-1]:
check(label, solve(*args), 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 |
|---|---|---|---|
| regression: no-zone default | [None, 10] | [None, 10] | Passed |
| partial repair probe: no-zone default | [None, 10] | [None, 10] | Passed |
| second regression | [None, 10] | [None, 10] | Passed |
| normal control 1 | [6, 15] | [6, 15] | Passed |
| normal control 2 | [10, 20] | [10, 20] | Passed |
| normal control 3 | [34, 12] | [34, 12] | Passed |
| normal control 4 | [42, 12] | [42, 12] | Passed |
SHA-256 / 14b98743195fbf467dc66957ca02696d59dd87877915385bb1a9b501a5e7a932
Verification & scope
A deterministic toy pricing contract stipulated for this example; it does not reproduce the pricing of any real ride-hailing operator or regulator. 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:50:40.926080+00:00.
Case digest / 69a629574e343a54fb2d4866b6b2254facc92d66e80d6cd5daa7c50cf66988b2