FA-87726 / Collision detection broadphase / Open access
Move-buffer overlap test ignores the vertical upper bound · case 01
Proxies stacked far above still pair.
ROOT CAUSE
Only a.miny <= p.maxy is checked on y.
VERIFIED REPAIR
Check both y bounds.
Unsuccessful approach: Making the y test strict drops touching contacts.
Case contract
solve(proxies, moved): dynamic-tree pair update. For each distinct moved proxy q (first occurrence order) test every other proxy p; skip p when p also moved and p>q (that pair is found from p). Count every overlap test performed; closed intervals. Return [sorted unique [min,max] pairs, test count].
Why this case matters
Broadphase stages decide which object pairs ever reach narrowphase; a wrong boundary, ordering or bookkeeping rule silently drops real contacts or floods the solver with false candidates.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(proxies, moved):
box = {p[0]: p for p in proxies}
mv = set(moved)
seen = set()
raw = []
tests = 0
for q in moved:
if q in seen:
continue
seen.add(q)
a = box[q]
for p in proxies:
if p[0] == q:
continue
if p[0] in mv and p[0] > q:
continue
tests += 1
if a[1] <= p[3] and p[1] <= a[3] and a[2] <= p[4]:
raw.append((min(q, p[0]), max(q, p[0])))
pairs = sorted(set(raw))
return [[list(x) for x in pairs], tests]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[25, 3.0, -5.0, 3.0, -5.0], [20, 5.0, -1.0, 5.0, -1.0], [21, 3.0, 4.0, 4.0, 6.0], [11, -5.0, -2.0, -2.0, -1.0], [7, -5.0, 1.0, -2.0, 2.0]], [20]], [[], 4]], [[[[37, -2.0, -1.0, 1.0, -1.0], [7, 1.0, 1.0, 4.0, 4.0], [13, -4.0, 2.0, -3.0, 3.0], [12, -2.0, -4.0, -2.0, -1.0], [39, -3.0, -3.0, 0.0, 0.0]], [13, 13, 7, 12]], [[[12, 37], [12, 39]], 9]], [[[[9, 5.0, -3.0, 8.0, -2.0], [5, -4.0, 1.0, -2.0, 3.0], [17, 4.0, 3.0, 7.0, 6.0], [24, -2.0, -1.0, 1.0, 2.0]], [17, 9, 17, 9]], [[], 5]], [[[[24, -4.0, 5.0, -1.0, 7.0], [30, 3.0, -3.0, 3.0, -1.0], [34, -5.0, -2.0, -4.0, -1.0], [35, -4.0, -2.0, -1.0, 1.0], [6, 5.0, 5.0, 6.0, 6.0], [25, -4.0, 0.0, -2.0, 2.0], [18, 3.0, -2.0, 3.0, -2.0]], [30, 35, 6, 24]], [[[18, 30], [25, 35], [34, 35]], 18]], [[[[36, -1.0, 3.0, -1.0, 3.0], [18, -4.0, -3.0, -3.0, -2.0]], [36, 18, 36]], [[], 1]], [[[[31, -4.0, 0.0, -4.0, 3.0], [16, 3.0, -2.0, 4.0, -1.0], [22, 3.0, -3.0, 6.0, -1.0], [37, 4.0, -1.0, 6.0, 2.0]], [22, 31, 22, 22]], [[[16, 22], [22, 37]], 5]], [[[[12, -3.0, -4.0, -3.0, -3.0], [30, -3.0, 0.0, 0.0, 3.0], [38, 5.0, -3.0, 5.0, -2.0], [39, -1.0, -4.0, -1.0, -4.0], [1, 1.0, 0.0, 4.0, 3.0], [34, 1.0, 5.0, 4.0, 6.0]], [39, 38, 39, 12]], [[], 12]], [[[[32, 3.0, -4.0, 5.0, -3.0], [4, 0.0, 2.0, 1.0, 4.0], [26, 1.0, -2.0, 2.0, 1.0], [27, 4.0, 4.0, 5.0, 6.0], [36, 2.0, 4.0, 5.0, 7.0], [9, -4.0, 2.0, -1.0, 5.0], [38, -3.0, 0.0, -3.0, 3.0]], [9, 32]], [[[9, 38]], 11]]], [[[[[16, 5.0, -3.0, 8.0, 0.0], [11, 3.0, 4.0, 6.0, 4.0], [37, 5.0, 1.0, 5.0, 4.0], [7, -2.0, 3.0, -1.0, 3.0]], [11]], [[[11, 37]], 3]], [[[[31, 0.0, -3.0, 0.0, -2.0], [17, 1.0, 3.0, 2.0, 6.0], [37, 1.0, 5.0, 4.0, 7.0], [28, -3.0, 5.0, -3.0, 6.0], [8, -1.0, 5.0, 0.0, 8.0], [26, 3.0, -4.0, 6.0, -2.0]], [31]], [[], 5]], [[[[20, -2.0, 4.0, 1.0, 6.0], [27, 2.0, -1.0, 3.0, 2.0], [32, 5.0, -3.0, 8.0, 0.0], [6, 2.0, -1.0, 5.0, 2.0], [13, -1.0, 4.0, -1.0, 4.0], [25, -5.0, -4.0, -5.0, -3.0]], [20, 6, 6]], [[[6, 27], [6, 32], [13, 20]], 9]], [[[[17, -3.0, -2.0, -2.0, 0.0], [33, 5.0, 5.0, 5.0, 5.0], [11, -3.0, -2.0, -2.0, 0.0], [22, -2.0, 0.0, -2.0, 2.0], [35, 0.0, -4.0, 3.0, -2.0], [24, -5.0, 0.0, -5.0, 2.0], [37, -1.0, -3.0, 1.0, -3.0], [4, -1.0, 2.0, 0.0, 5.0]], [37, 17]], [[[11, 17], [17, 22], [35, 37]], 13]], [[[[31, -3.0, 0.0, -3.0, 1.0], [19, 2.0, 2.0, 2.0, 3.0], [15, 5.0, 1.0, 5.0, 1.0], [32, 5.0, -5.0, 8.0, -3.0], [22, 1.0, -2.0, 1.0, 0.0], [17, -2.0, -4.0, 0.0, -1.0], [38, -1.0, 4.0, 0.0, 5.0]], [32]], [[], 6]], [[[[34, 2.0, -5.0, 2.0, -5.0], [24, -3.0, -5.0, 0.0, -2.0], [28, 2.0, 3.0, 2.0, 3.0]], [24, 28]], [[], 3]], [[[[37, -4.0, 3.0, -1.0, 4.0], [20, 1.0, 0.0, 4.0, 3.0], [31, 5.0, -3.0, 7.0, -3.0], [12, 5.0, -5.0, 7.0, -2.0]], [12]], [[[12, 31]], 3]], [[[[26, 1.0, -5.0, 2.0, -3.0], [25, 0.0, 2.0, 2.0, 3.0], [28, -5.0, -1.0, -2.0, 2.0], [10, 2.0, -3.0, 5.0, 0.0], [13, -5.0, -5.0, -3.0, -3.0], [14, -2.0, -1.0, 1.0, 1.0]], [14, 25, 13, 26]], [[[10, 26], [14, 28]], 14]]], [[[[[24, 3.0, -1.0, 5.0, -1.0], [12, 2.0, -3.0, 5.0, -1.0], [23, -2.0, 1.0, 0.0, 4.0], [35, 0.0, 5.0, 0.0, 8.0], [29, -5.0, 5.0, -4.0, 6.0]], [12, 35]], [[[12, 24]], 7]], [[[[39, 0.0, -2.0, 2.0, -1.0], [36, 4.0, 1.0, 7.0, 1.0], [29, 1.0, -5.0, 3.0, -5.0], [6, -2.0, 4.0, 1.0, 6.0], [9, 4.0, 0.0, 7.0, 3.0], [17, 5.0, 1.0, 6.0, 3.0]], [6, 36, 17, 9, 36]], [[[9, 17], [9, 36], [17, 36]], 14]], [[[[17, 3.0, 5.0, 4.0, 7.0], [12, 0.0, 1.0, 1.0, 3.0], [31, -4.0, 2.0, -2.0, 4.0], [21, -2.0, 4.0, 1.0, 6.0], [11, -5.0, -2.0, -5.0, 0.0], [4, 4.0, 5.0, 7.0, 8.0], [25, -3.0, -2.0, -3.0, -1.0], [13, -3.0, 5.0, 0.0, 8.0]], [13, 4, 17, 25, 4]], [[[4, 17], [13, 21]], 22]], [[[[39, 5.0, -1.0, 7.0, -1.0], [8, 2.0, 4.0, 2.0, 7.0], [3, -1.0, 5.0, 1.0, 8.0], [30, 0.0, 2.0, 2.0, 5.0], [21, -4.0, 3.0, -3.0, 4.0], [27, 5.0, 4.0, 8.0, 5.0]], [27, 30, 30, 3]], [[[3, 30], [8, 30]], 12]], [[[[34, 2.0, 0.0, 3.0, 3.0], [29, -4.0, 2.0, -2.0, 5.0], [4, 1.0, 1.0, 4.0, 4.0], [11, -5.0, 1.0, -4.0, 2.0], [21, 2.0, 0.0, 3.0, 1.0], [8, 3.0, 4.0, 4.0, 6.0], [17, 3.0, 1.0, 4.0, 1.0]], [8, 34]], [[[4, 8], [4, 34], [17, 34], [21, 34]], 11]], [[[[9, -1.0, 3.0, 2.0, 3.0], [16, 5.0, -5.0, 8.0, -2.0], [7, -2.0, -2.0, -2.0, 0.0], [27, -4.0, 3.0, -3.0, 5.0], [4, -1.0, 2.0, 0.0, 2.0], [29, -1.0, -5.0, 0.0, -2.0], [12, -2.0, 3.0, -1.0, 3.0]], [16, 16, 4, 29, 12]], [[[9, 12]], 18]], [[[[29, -4.0, 3.0, -1.0, 3.0], [19, -2.0, 3.0, -2.0, 6.0], [33, 5.0, -4.0, 6.0, -2.0], [22, -1.0, -5.0, 2.0, -2.0], [3, 1.0, 2.0, 3.0, 3.0]], [22, 19]], [[[19, 29]], 7]], [[[[34, -3.0, 4.0, -2.0, 6.0], [5, 4.0, 4.0, 4.0, 4.0], [11, -2.0, 2.0, 1.0, 3.0], [12, -3.0, 0.0, -1.0, 2.0], [31, -4.0, 4.0, -1.0, 5.0]], [31, 34, 31]], [[[31, 34]], 7]]], [[[[[4, 3.0, -3.0, 3.0, -1.0], [19, -1.0, -2.0, 2.0, 0.0], [38, -2.0, 1.0, 1.0, 1.0], [32, -4.0, 1.0, -3.0, 2.0]], [4, 19, 4, 32]], [[], 6]], [[[[35, 3.0, 3.0, 5.0, 3.0], [38, 4.0, -4.0, 4.0, -1.0], [33, -5.0, -3.0, -5.0, -3.0], [10, 0.0, 3.0, 1.0, 5.0], [22, -4.0, 1.0, -1.0, 3.0]], [33, 10, 38, 22]], [[], 10]], [[[[18, -4.0, 2.0, -4.0, 4.0], [30, 5.0, 5.0, 5.0, 6.0], [7, -5.0, 5.0, -3.0, 7.0], [32, -4.0, 2.0, -2.0, 4.0], [12, -2.0, 3.0, -2.0, 3.0]], [30, 18, 12, 32, 18]], [[[12, 32], [18, 32]], 10]], [[[[20, -3.0, -4.0, -3.0, -1.0], [37, 4.0, -4.0, 7.0, -4.0], [14, 3.0, -5.0, 5.0, -5.0], [39, -5.0, 3.0, -5.0, 4.0]], [39, 37, 20, 39]], [[], 6]], [[[[21, -4.0, -3.0, -2.0, -2.0], [3, 1.0, 3.0, 3.0, 5.0]], [3]], [[], 1]], [[[[35, 2.0, -1.0, 5.0, 1.0], [31, 0.0, 2.0, 2.0, 3.0], [1, -2.0, -1.0, 0.0, 2.0], [18, 0.0, -5.0, 2.0, -4.0], [19, -5.0, 3.0, -2.0, 5.0], [9, -2.0, 2.0, 0.0, 2.0], [11, -4.0, -2.0, -4.0, -1.0], [15, -5.0, 4.0, -5.0, 6.0], [6, -1.0, -3.0, -1.0, -2.0]], [9, 15, 19, 18, 31]], [[[1, 9], [1, 31], [9, 31], [15, 19]], 30]], [[[[9, 2.0, 4.0, 2.0, 5.0], [16, 3.0, -4.0, 3.0, -1.0], [37, 0.0, -5.0, 2.0, -5.0], [23, -5.0, -1.0, -5.0, 1.0], [33, 0.0, -3.0, 1.0, -3.0], [12, 1.0, 3.0, 1.0, 5.0], [17, 1.0, -3.0, 3.0, -2.0], [7, 1.0, 0.0, 1.0, 2.0]], [33, 37, 7]], [[[17, 33]], 18]], [[[[6, 3.0, 1.0, 5.0, 2.0], [27, -1.0, -4.0, 2.0, -1.0], [34, 2.0, 3.0, 2.0, 5.0], [11, -2.0, 2.0, -2.0, 3.0], [1, -5.0, -2.0, -4.0, 0.0]], [11, 6]], [[], 7]]], [[[[[33, -1.0, -1.0, 2.0, 2.0], [39, 3.0, -4.0, 6.0, -1.0], [3, 4.0, -4.0, 4.0, -4.0], [24, 5.0, -2.0, 5.0, -2.0], [38, 0.0, -5.0, 2.0, -2.0]], [39, 39, 39, 38, 39]], [[[3, 39], [24, 39]], 7]], [[[[14, 3.0, 3.0, 4.0, 3.0], [12, 4.0, -1.0, 7.0, -1.0], [16, -4.0, 3.0, -2.0, 5.0], [19, 3.0, -5.0, 3.0, -5.0], [9, 1.0, -1.0, 3.0, 0.0]], [16, 12, 16, 19, 12]], [[], 9]], [[[[33, 3.0, -2.0, 6.0, -1.0], [30, 0.0, 1.0, 2.0, 1.0], [3, -3.0, 5.0, -3.0, 5.0], [34, -3.0, 1.0, -1.0, 1.0], [1, -1.0, 2.0, 0.0, 5.0], [28, 2.0, -1.0, 5.0, -1.0], [16, 3.0, 4.0, 4.0, 7.0], [17, -1.0, 3.0, 1.0, 6.0], [15, -2.0, 4.0, -1.0, 4.0], [11, -4.0, 0.0, -4.0, 0.0], [12, 3.0, -1.0, 3.0, 0.0]], [15, 17, 33]], [[[1, 15], [1, 17], [12, 33], [15, 17], [28, 33]], 27]], [[[[27, -3.0, 5.0, -1.0, 6.0], [21, -5.0, 1.0, -5.0, 1.0], [12, 3.0, -1.0, 4.0, 0.0]], [12, 21, 21, 21]], [[], 3]], [[[[39, -5.0, -5.0, -3.0, -3.0], [11, 4.0, -4.0, 5.0, -2.0]], [39]], [[], 1]], [[[[7, -4.0, -3.0, -1.0, -3.0], [14, -4.0, 4.0, -3.0, 4.0], [12, 4.0, 4.0, 4.0, 4.0], [15, -5.0, 4.0, -4.0, 4.0], [6, 2.0, 0.0, 5.0, 3.0], [31, -5.0, -5.0, -3.0, -5.0], [17, -5.0, -5.0, -3.0, -3.0], [5, -3.0, -4.0, 0.0, -2.0], [9, -2.0, 0.0, -1.0, 1.0], [32, -4.0, 0.0, -1.0, 3.0]], [12, 15, 32, 17]], [[[5, 17], [7, 17], [9, 32], [14, 15], [17, 31]], 30]], [[[[33, 3.0, -3.0, 5.0, 0.0], [6, -3.0, -5.0, -2.0, -2.0], [23, 4.0, 4.0, 6.0, 5.0], [37, 5.0, 1.0, 8.0, 2.0], [8, 0.0, 1.0, 2.0, 4.0], [22, -3.0, 3.0, 0.0, 6.0], [27, 1.0, 0.0, 1.0, 1.0]], [22, 6, 8]], [[[8, 22], [8, 27]], 15]], [[[[11, -3.0, -3.0, 0.0, -1.0], [32, 1.0, -1.0, 2.0, 1.0], [16, 5.0, 4.0, 7.0, 4.0], [29, -1.0, 1.0, 1.0, 2.0], [36, 5.0, 2.0, 6.0, 2.0]], [36, 16, 16, 11, 36]], [[], 9]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("case %d" % i, 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 |
|---|---|---|---|
| case 0 | [[], 4] | [[], 4] | Passed |
| case 1 | [[[12, 37], [12, 39]], 9] | [[[12, 37], [12, 39]], 9] | Passed |
| case 2 | [[], 5] | [[], 5] | Passed |
| case 3 | [[[18, 30], [24, 35], [25, 35], [34, 35]], 18] | [[[18, 30], [25, 35], [34, 35]], 18] | Failed |
| case 4 | [[], 1] | [[], 1] | Passed |
| case 5 | [[[16, 22], [22, 37]], 5] | [[[16, 22], [22, 37]], 5] | Passed |
| case 6 | [[[12, 30], [30, 39]], 12] | [[], 12] | Failed |
| case 7 | [[[9, 38], [27, 32], [32, 36]], 11] | [[[9, 38]], 11] | Failed |
SHA-256 / fa07010e18e53c7af2ae8bf3b631179d87556daf758592556d7e6819e7a9b7d8
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(proxies, moved):
box = {p[0]: p for p in proxies}
mv = set(moved)
seen = set()
raw = []
tests = 0
for q in moved:
if q in seen:
continue
seen.add(q)
a = box[q]
for p in proxies:
if p[0] == q:
continue
if p[0] in mv and p[0] > q:
continue
tests += 1
if a[1] <= p[3] and p[1] <= a[3] and a[2] < p[4] and p[2] < a[4]:
raw.append((min(q, p[0]), max(q, p[0])))
pairs = sorted(set(raw))
return [[list(x) for x in pairs], tests]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[25, 3.0, -5.0, 3.0, -5.0], [20, 5.0, -1.0, 5.0, -1.0], [21, 3.0, 4.0, 4.0, 6.0], [11, -5.0, -2.0, -2.0, -1.0], [7, -5.0, 1.0, -2.0, 2.0]], [20]], [[], 4]], [[[[37, -2.0, -1.0, 1.0, -1.0], [7, 1.0, 1.0, 4.0, 4.0], [13, -4.0, 2.0, -3.0, 3.0], [12, -2.0, -4.0, -2.0, -1.0], [39, -3.0, -3.0, 0.0, 0.0]], [13, 13, 7, 12]], [[[12, 37], [12, 39]], 9]], [[[[9, 5.0, -3.0, 8.0, -2.0], [5, -4.0, 1.0, -2.0, 3.0], [17, 4.0, 3.0, 7.0, 6.0], [24, -2.0, -1.0, 1.0, 2.0]], [17, 9, 17, 9]], [[], 5]], [[[[24, -4.0, 5.0, -1.0, 7.0], [30, 3.0, -3.0, 3.0, -1.0], [34, -5.0, -2.0, -4.0, -1.0], [35, -4.0, -2.0, -1.0, 1.0], [6, 5.0, 5.0, 6.0, 6.0], [25, -4.0, 0.0, -2.0, 2.0], [18, 3.0, -2.0, 3.0, -2.0]], [30, 35, 6, 24]], [[[18, 30], [25, 35], [34, 35]], 18]], [[[[36, -1.0, 3.0, -1.0, 3.0], [18, -4.0, -3.0, -3.0, -2.0]], [36, 18, 36]], [[], 1]], [[[[31, -4.0, 0.0, -4.0, 3.0], [16, 3.0, -2.0, 4.0, -1.0], [22, 3.0, -3.0, 6.0, -1.0], [37, 4.0, -1.0, 6.0, 2.0]], [22, 31, 22, 22]], [[[16, 22], [22, 37]], 5]], [[[[12, -3.0, -4.0, -3.0, -3.0], [30, -3.0, 0.0, 0.0, 3.0], [38, 5.0, -3.0, 5.0, -2.0], [39, -1.0, -4.0, -1.0, -4.0], [1, 1.0, 0.0, 4.0, 3.0], [34, 1.0, 5.0, 4.0, 6.0]], [39, 38, 39, 12]], [[], 12]], [[[[32, 3.0, -4.0, 5.0, -3.0], [4, 0.0, 2.0, 1.0, 4.0], [26, 1.0, -2.0, 2.0, 1.0], [27, 4.0, 4.0, 5.0, 6.0], [36, 2.0, 4.0, 5.0, 7.0], [9, -4.0, 2.0, -1.0, 5.0], [38, -3.0, 0.0, -3.0, 3.0]], [9, 32]], [[[9, 38]], 11]]], [[[[[16, 5.0, -3.0, 8.0, 0.0], [11, 3.0, 4.0, 6.0, 4.0], [37, 5.0, 1.0, 5.0, 4.0], [7, -2.0, 3.0, -1.0, 3.0]], [11]], [[[11, 37]], 3]], [[[[31, 0.0, -3.0, 0.0, -2.0], [17, 1.0, 3.0, 2.0, 6.0], [37, 1.0, 5.0, 4.0, 7.0], [28, -3.0, 5.0, -3.0, 6.0], [8, -1.0, 5.0, 0.0, 8.0], [26, 3.0, -4.0, 6.0, -2.0]], [31]], [[], 5]], [[[[20, -2.0, 4.0, 1.0, 6.0], [27, 2.0, -1.0, 3.0, 2.0], [32, 5.0, -3.0, 8.0, 0.0], [6, 2.0, -1.0, 5.0, 2.0], [13, -1.0, 4.0, -1.0, 4.0], [25, -5.0, -4.0, -5.0, -3.0]], [20, 6, 6]], [[[6, 27], [6, 32], [13, 20]], 9]], [[[[17, -3.0, -2.0, -2.0, 0.0], [33, 5.0, 5.0, 5.0, 5.0], [11, -3.0, -2.0, -2.0, 0.0], [22, -2.0, 0.0, -2.0, 2.0], [35, 0.0, -4.0, 3.0, -2.0], [24, -5.0, 0.0, -5.0, 2.0], [37, -1.0, -3.0, 1.0, -3.0], [4, -1.0, 2.0, 0.0, 5.0]], [37, 17]], [[[11, 17], [17, 22], [35, 37]], 13]], [[[[31, -3.0, 0.0, -3.0, 1.0], [19, 2.0, 2.0, 2.0, 3.0], [15, 5.0, 1.0, 5.0, 1.0], [32, 5.0, -5.0, 8.0, -3.0], [22, 1.0, -2.0, 1.0, 0.0], [17, -2.0, -4.0, 0.0, -1.0], [38, -1.0, 4.0, 0.0, 5.0]], [32]], [[], 6]], [[[[34, 2.0, -5.0, 2.0, -5.0], [24, -3.0, -5.0, 0.0, -2.0], [28, 2.0, 3.0, 2.0, 3.0]], [24, 28]], [[], 3]], [[[[37, -4.0, 3.0, -1.0, 4.0], [20, 1.0, 0.0, 4.0, 3.0], [31, 5.0, -3.0, 7.0, -3.0], [12, 5.0, -5.0, 7.0, -2.0]], [12]], [[[12, 31]], 3]], [[[[26, 1.0, -5.0, 2.0, -3.0], [25, 0.0, 2.0, 2.0, 3.0], [28, -5.0, -1.0, -2.0, 2.0], [10, 2.0, -3.0, 5.0, 0.0], [13, -5.0, -5.0, -3.0, -3.0], [14, -2.0, -1.0, 1.0, 1.0]], [14, 25, 13, 26]], [[[10, 26], [14, 28]], 14]]], [[[[[24, 3.0, -1.0, 5.0, -1.0], [12, 2.0, -3.0, 5.0, -1.0], [23, -2.0, 1.0, 0.0, 4.0], [35, 0.0, 5.0, 0.0, 8.0], [29, -5.0, 5.0, -4.0, 6.0]], [12, 35]], [[[12, 24]], 7]], [[[[39, 0.0, -2.0, 2.0, -1.0], [36, 4.0, 1.0, 7.0, 1.0], [29, 1.0, -5.0, 3.0, -5.0], [6, -2.0, 4.0, 1.0, 6.0], [9, 4.0, 0.0, 7.0, 3.0], [17, 5.0, 1.0, 6.0, 3.0]], [6, 36, 17, 9, 36]], [[[9, 17], [9, 36], [17, 36]], 14]], [[[[17, 3.0, 5.0, 4.0, 7.0], [12, 0.0, 1.0, 1.0, 3.0], [31, -4.0, 2.0, -2.0, 4.0], [21, -2.0, 4.0, 1.0, 6.0], [11, -5.0, -2.0, -5.0, 0.0], [4, 4.0, 5.0, 7.0, 8.0], [25, -3.0, -2.0, -3.0, -1.0], [13, -3.0, 5.0, 0.0, 8.0]], [13, 4, 17, 25, 4]], [[[4, 17], [13, 21]], 22]], [[[[39, 5.0, -1.0, 7.0, -1.0], [8, 2.0, 4.0, 2.0, 7.0], [3, -1.0, 5.0, 1.0, 8.0], [30, 0.0, 2.0, 2.0, 5.0], [21, -4.0, 3.0, -3.0, 4.0], [27, 5.0, 4.0, 8.0, 5.0]], [27, 30, 30, 3]], [[[3, 30], [8, 30]], 12]], [[[[34, 2.0, 0.0, 3.0, 3.0], [29, -4.0, 2.0, -2.0, 5.0], [4, 1.0, 1.0, 4.0, 4.0], [11, -5.0, 1.0, -4.0, 2.0], [21, 2.0, 0.0, 3.0, 1.0], [8, 3.0, 4.0, 4.0, 6.0], [17, 3.0, 1.0, 4.0, 1.0]], [8, 34]], [[[4, 8], [4, 34], [17, 34], [21, 34]], 11]], [[[[9, -1.0, 3.0, 2.0, 3.0], [16, 5.0, -5.0, 8.0, -2.0], [7, -2.0, -2.0, -2.0, 0.0], [27, -4.0, 3.0, -3.0, 5.0], [4, -1.0, 2.0, 0.0, 2.0], [29, -1.0, -5.0, 0.0, -2.0], [12, -2.0, 3.0, -1.0, 3.0]], [16, 16, 4, 29, 12]], [[[9, 12]], 18]], [[[[29, -4.0, 3.0, -1.0, 3.0], [19, -2.0, 3.0, -2.0, 6.0], [33, 5.0, -4.0, 6.0, -2.0], [22, -1.0, -5.0, 2.0, -2.0], [3, 1.0, 2.0, 3.0, 3.0]], [22, 19]], [[[19, 29]], 7]], [[[[34, -3.0, 4.0, -2.0, 6.0], [5, 4.0, 4.0, 4.0, 4.0], [11, -2.0, 2.0, 1.0, 3.0], [12, -3.0, 0.0, -1.0, 2.0], [31, -4.0, 4.0, -1.0, 5.0]], [31, 34, 31]], [[[31, 34]], 7]]], [[[[[4, 3.0, -3.0, 3.0, -1.0], [19, -1.0, -2.0, 2.0, 0.0], [38, -2.0, 1.0, 1.0, 1.0], [32, -4.0, 1.0, -3.0, 2.0]], [4, 19, 4, 32]], [[], 6]], [[[[35, 3.0, 3.0, 5.0, 3.0], [38, 4.0, -4.0, 4.0, -1.0], [33, -5.0, -3.0, -5.0, -3.0], [10, 0.0, 3.0, 1.0, 5.0], [22, -4.0, 1.0, -1.0, 3.0]], [33, 10, 38, 22]], [[], 10]], [[[[18, -4.0, 2.0, -4.0, 4.0], [30, 5.0, 5.0, 5.0, 6.0], [7, -5.0, 5.0, -3.0, 7.0], [32, -4.0, 2.0, -2.0, 4.0], [12, -2.0, 3.0, -2.0, 3.0]], [30, 18, 12, 32, 18]], [[[12, 32], [18, 32]], 10]], [[[[20, -3.0, -4.0, -3.0, -1.0], [37, 4.0, -4.0, 7.0, -4.0], [14, 3.0, -5.0, 5.0, -5.0], [39, -5.0, 3.0, -5.0, 4.0]], [39, 37, 20, 39]], [[], 6]], [[[[21, -4.0, -3.0, -2.0, -2.0], [3, 1.0, 3.0, 3.0, 5.0]], [3]], [[], 1]], [[[[35, 2.0, -1.0, 5.0, 1.0], [31, 0.0, 2.0, 2.0, 3.0], [1, -2.0, -1.0, 0.0, 2.0], [18, 0.0, -5.0, 2.0, -4.0], [19, -5.0, 3.0, -2.0, 5.0], [9, -2.0, 2.0, 0.0, 2.0], [11, -4.0, -2.0, -4.0, -1.0], [15, -5.0, 4.0, -5.0, 6.0], [6, -1.0, -3.0, -1.0, -2.0]], [9, 15, 19, 18, 31]], [[[1, 9], [1, 31], [9, 31], [15, 19]], 30]], [[[[9, 2.0, 4.0, 2.0, 5.0], [16, 3.0, -4.0, 3.0, -1.0], [37, 0.0, -5.0, 2.0, -5.0], [23, -5.0, -1.0, -5.0, 1.0], [33, 0.0, -3.0, 1.0, -3.0], [12, 1.0, 3.0, 1.0, 5.0], [17, 1.0, -3.0, 3.0, -2.0], [7, 1.0, 0.0, 1.0, 2.0]], [33, 37, 7]], [[[17, 33]], 18]], [[[[6, 3.0, 1.0, 5.0, 2.0], [27, -1.0, -4.0, 2.0, -1.0], [34, 2.0, 3.0, 2.0, 5.0], [11, -2.0, 2.0, -2.0, 3.0], [1, -5.0, -2.0, -4.0, 0.0]], [11, 6]], [[], 7]]], [[[[[33, -1.0, -1.0, 2.0, 2.0], [39, 3.0, -4.0, 6.0, -1.0], [3, 4.0, -4.0, 4.0, -4.0], [24, 5.0, -2.0, 5.0, -2.0], [38, 0.0, -5.0, 2.0, -2.0]], [39, 39, 39, 38, 39]], [[[3, 39], [24, 39]], 7]], [[[[14, 3.0, 3.0, 4.0, 3.0], [12, 4.0, -1.0, 7.0, -1.0], [16, -4.0, 3.0, -2.0, 5.0], [19, 3.0, -5.0, 3.0, -5.0], [9, 1.0, -1.0, 3.0, 0.0]], [16, 12, 16, 19, 12]], [[], 9]], [[[[33, 3.0, -2.0, 6.0, -1.0], [30, 0.0, 1.0, 2.0, 1.0], [3, -3.0, 5.0, -3.0, 5.0], [34, -3.0, 1.0, -1.0, 1.0], [1, -1.0, 2.0, 0.0, 5.0], [28, 2.0, -1.0, 5.0, -1.0], [16, 3.0, 4.0, 4.0, 7.0], [17, -1.0, 3.0, 1.0, 6.0], [15, -2.0, 4.0, -1.0, 4.0], [11, -4.0, 0.0, -4.0, 0.0], [12, 3.0, -1.0, 3.0, 0.0]], [15, 17, 33]], [[[1, 15], [1, 17], [12, 33], [15, 17], [28, 33]], 27]], [[[[27, -3.0, 5.0, -1.0, 6.0], [21, -5.0, 1.0, -5.0, 1.0], [12, 3.0, -1.0, 4.0, 0.0]], [12, 21, 21, 21]], [[], 3]], [[[[39, -5.0, -5.0, -3.0, -3.0], [11, 4.0, -4.0, 5.0, -2.0]], [39]], [[], 1]], [[[[7, -4.0, -3.0, -1.0, -3.0], [14, -4.0, 4.0, -3.0, 4.0], [12, 4.0, 4.0, 4.0, 4.0], [15, -5.0, 4.0, -4.0, 4.0], [6, 2.0, 0.0, 5.0, 3.0], [31, -5.0, -5.0, -3.0, -5.0], [17, -5.0, -5.0, -3.0, -3.0], [5, -3.0, -4.0, 0.0, -2.0], [9, -2.0, 0.0, -1.0, 1.0], [32, -4.0, 0.0, -1.0, 3.0]], [12, 15, 32, 17]], [[[5, 17], [7, 17], [9, 32], [14, 15], [17, 31]], 30]], [[[[33, 3.0, -3.0, 5.0, 0.0], [6, -3.0, -5.0, -2.0, -2.0], [23, 4.0, 4.0, 6.0, 5.0], [37, 5.0, 1.0, 8.0, 2.0], [8, 0.0, 1.0, 2.0, 4.0], [22, -3.0, 3.0, 0.0, 6.0], [27, 1.0, 0.0, 1.0, 1.0]], [22, 6, 8]], [[[8, 22], [8, 27]], 15]], [[[[11, -3.0, -3.0, 0.0, -1.0], [32, 1.0, -1.0, 2.0, 1.0], [16, 5.0, 4.0, 7.0, 4.0], [29, -1.0, 1.0, 1.0, 2.0], [36, 5.0, 2.0, 6.0, 2.0]], [36, 16, 16, 11, 36]], [[], 9]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("case %d" % i, 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 |
|---|---|---|---|
| case 0 | [[], 4] | [[], 4] | Passed |
| case 1 | [[[12, 39]], 9] | [[[12, 37], [12, 39]], 9] | Failed |
| case 2 | [[], 5] | [[], 5] | Passed |
| case 3 | [[[18, 30], [25, 35], [34, 35]], 18] | [[[18, 30], [25, 35], [34, 35]], 18] | Passed |
| case 4 | [[], 1] | [[], 1] | Passed |
| case 5 | [[[16, 22]], 5] | [[[16, 22], [22, 37]], 5] | Failed |
| case 6 | [[], 12] | [[], 12] | Passed |
| case 7 | [[[9, 38]], 11] | [[[9, 38]], 11] | Passed |
SHA-256 / 4679a868300b769a40e927a230353cabe2af28ef9e777fc11b229f25c2cd2dd1
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(proxies, moved):
box = {p[0]: p for p in proxies}
mv = set(moved)
seen = set()
raw = []
tests = 0
for q in moved:
if q in seen:
continue
seen.add(q)
a = box[q]
for p in proxies:
if p[0] == q:
continue
if p[0] in mv and p[0] > q:
continue
tests += 1
if a[1] <= p[3] and p[1] <= a[3] and a[2] <= p[4] and p[2] <= a[4]:
raw.append((min(q, p[0]), max(q, p[0])))
pairs = sorted(set(raw))
return [[list(x) for x in pairs], tests]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[[[[[25, 3.0, -5.0, 3.0, -5.0], [20, 5.0, -1.0, 5.0, -1.0], [21, 3.0, 4.0, 4.0, 6.0], [11, -5.0, -2.0, -2.0, -1.0], [7, -5.0, 1.0, -2.0, 2.0]], [20]], [[], 4]], [[[[37, -2.0, -1.0, 1.0, -1.0], [7, 1.0, 1.0, 4.0, 4.0], [13, -4.0, 2.0, -3.0, 3.0], [12, -2.0, -4.0, -2.0, -1.0], [39, -3.0, -3.0, 0.0, 0.0]], [13, 13, 7, 12]], [[[12, 37], [12, 39]], 9]], [[[[9, 5.0, -3.0, 8.0, -2.0], [5, -4.0, 1.0, -2.0, 3.0], [17, 4.0, 3.0, 7.0, 6.0], [24, -2.0, -1.0, 1.0, 2.0]], [17, 9, 17, 9]], [[], 5]], [[[[24, -4.0, 5.0, -1.0, 7.0], [30, 3.0, -3.0, 3.0, -1.0], [34, -5.0, -2.0, -4.0, -1.0], [35, -4.0, -2.0, -1.0, 1.0], [6, 5.0, 5.0, 6.0, 6.0], [25, -4.0, 0.0, -2.0, 2.0], [18, 3.0, -2.0, 3.0, -2.0]], [30, 35, 6, 24]], [[[18, 30], [25, 35], [34, 35]], 18]], [[[[36, -1.0, 3.0, -1.0, 3.0], [18, -4.0, -3.0, -3.0, -2.0]], [36, 18, 36]], [[], 1]], [[[[31, -4.0, 0.0, -4.0, 3.0], [16, 3.0, -2.0, 4.0, -1.0], [22, 3.0, -3.0, 6.0, -1.0], [37, 4.0, -1.0, 6.0, 2.0]], [22, 31, 22, 22]], [[[16, 22], [22, 37]], 5]], [[[[12, -3.0, -4.0, -3.0, -3.0], [30, -3.0, 0.0, 0.0, 3.0], [38, 5.0, -3.0, 5.0, -2.0], [39, -1.0, -4.0, -1.0, -4.0], [1, 1.0, 0.0, 4.0, 3.0], [34, 1.0, 5.0, 4.0, 6.0]], [39, 38, 39, 12]], [[], 12]], [[[[32, 3.0, -4.0, 5.0, -3.0], [4, 0.0, 2.0, 1.0, 4.0], [26, 1.0, -2.0, 2.0, 1.0], [27, 4.0, 4.0, 5.0, 6.0], [36, 2.0, 4.0, 5.0, 7.0], [9, -4.0, 2.0, -1.0, 5.0], [38, -3.0, 0.0, -3.0, 3.0]], [9, 32]], [[[9, 38]], 11]]], [[[[[16, 5.0, -3.0, 8.0, 0.0], [11, 3.0, 4.0, 6.0, 4.0], [37, 5.0, 1.0, 5.0, 4.0], [7, -2.0, 3.0, -1.0, 3.0]], [11]], [[[11, 37]], 3]], [[[[31, 0.0, -3.0, 0.0, -2.0], [17, 1.0, 3.0, 2.0, 6.0], [37, 1.0, 5.0, 4.0, 7.0], [28, -3.0, 5.0, -3.0, 6.0], [8, -1.0, 5.0, 0.0, 8.0], [26, 3.0, -4.0, 6.0, -2.0]], [31]], [[], 5]], [[[[20, -2.0, 4.0, 1.0, 6.0], [27, 2.0, -1.0, 3.0, 2.0], [32, 5.0, -3.0, 8.0, 0.0], [6, 2.0, -1.0, 5.0, 2.0], [13, -1.0, 4.0, -1.0, 4.0], [25, -5.0, -4.0, -5.0, -3.0]], [20, 6, 6]], [[[6, 27], [6, 32], [13, 20]], 9]], [[[[17, -3.0, -2.0, -2.0, 0.0], [33, 5.0, 5.0, 5.0, 5.0], [11, -3.0, -2.0, -2.0, 0.0], [22, -2.0, 0.0, -2.0, 2.0], [35, 0.0, -4.0, 3.0, -2.0], [24, -5.0, 0.0, -5.0, 2.0], [37, -1.0, -3.0, 1.0, -3.0], [4, -1.0, 2.0, 0.0, 5.0]], [37, 17]], [[[11, 17], [17, 22], [35, 37]], 13]], [[[[31, -3.0, 0.0, -3.0, 1.0], [19, 2.0, 2.0, 2.0, 3.0], [15, 5.0, 1.0, 5.0, 1.0], [32, 5.0, -5.0, 8.0, -3.0], [22, 1.0, -2.0, 1.0, 0.0], [17, -2.0, -4.0, 0.0, -1.0], [38, -1.0, 4.0, 0.0, 5.0]], [32]], [[], 6]], [[[[34, 2.0, -5.0, 2.0, -5.0], [24, -3.0, -5.0, 0.0, -2.0], [28, 2.0, 3.0, 2.0, 3.0]], [24, 28]], [[], 3]], [[[[37, -4.0, 3.0, -1.0, 4.0], [20, 1.0, 0.0, 4.0, 3.0], [31, 5.0, -3.0, 7.0, -3.0], [12, 5.0, -5.0, 7.0, -2.0]], [12]], [[[12, 31]], 3]], [[[[26, 1.0, -5.0, 2.0, -3.0], [25, 0.0, 2.0, 2.0, 3.0], [28, -5.0, -1.0, -2.0, 2.0], [10, 2.0, -3.0, 5.0, 0.0], [13, -5.0, -5.0, -3.0, -3.0], [14, -2.0, -1.0, 1.0, 1.0]], [14, 25, 13, 26]], [[[10, 26], [14, 28]], 14]]], [[[[[24, 3.0, -1.0, 5.0, -1.0], [12, 2.0, -3.0, 5.0, -1.0], [23, -2.0, 1.0, 0.0, 4.0], [35, 0.0, 5.0, 0.0, 8.0], [29, -5.0, 5.0, -4.0, 6.0]], [12, 35]], [[[12, 24]], 7]], [[[[39, 0.0, -2.0, 2.0, -1.0], [36, 4.0, 1.0, 7.0, 1.0], [29, 1.0, -5.0, 3.0, -5.0], [6, -2.0, 4.0, 1.0, 6.0], [9, 4.0, 0.0, 7.0, 3.0], [17, 5.0, 1.0, 6.0, 3.0]], [6, 36, 17, 9, 36]], [[[9, 17], [9, 36], [17, 36]], 14]], [[[[17, 3.0, 5.0, 4.0, 7.0], [12, 0.0, 1.0, 1.0, 3.0], [31, -4.0, 2.0, -2.0, 4.0], [21, -2.0, 4.0, 1.0, 6.0], [11, -5.0, -2.0, -5.0, 0.0], [4, 4.0, 5.0, 7.0, 8.0], [25, -3.0, -2.0, -3.0, -1.0], [13, -3.0, 5.0, 0.0, 8.0]], [13, 4, 17, 25, 4]], [[[4, 17], [13, 21]], 22]], [[[[39, 5.0, -1.0, 7.0, -1.0], [8, 2.0, 4.0, 2.0, 7.0], [3, -1.0, 5.0, 1.0, 8.0], [30, 0.0, 2.0, 2.0, 5.0], [21, -4.0, 3.0, -3.0, 4.0], [27, 5.0, 4.0, 8.0, 5.0]], [27, 30, 30, 3]], [[[3, 30], [8, 30]], 12]], [[[[34, 2.0, 0.0, 3.0, 3.0], [29, -4.0, 2.0, -2.0, 5.0], [4, 1.0, 1.0, 4.0, 4.0], [11, -5.0, 1.0, -4.0, 2.0], [21, 2.0, 0.0, 3.0, 1.0], [8, 3.0, 4.0, 4.0, 6.0], [17, 3.0, 1.0, 4.0, 1.0]], [8, 34]], [[[4, 8], [4, 34], [17, 34], [21, 34]], 11]], [[[[9, -1.0, 3.0, 2.0, 3.0], [16, 5.0, -5.0, 8.0, -2.0], [7, -2.0, -2.0, -2.0, 0.0], [27, -4.0, 3.0, -3.0, 5.0], [4, -1.0, 2.0, 0.0, 2.0], [29, -1.0, -5.0, 0.0, -2.0], [12, -2.0, 3.0, -1.0, 3.0]], [16, 16, 4, 29, 12]], [[[9, 12]], 18]], [[[[29, -4.0, 3.0, -1.0, 3.0], [19, -2.0, 3.0, -2.0, 6.0], [33, 5.0, -4.0, 6.0, -2.0], [22, -1.0, -5.0, 2.0, -2.0], [3, 1.0, 2.0, 3.0, 3.0]], [22, 19]], [[[19, 29]], 7]], [[[[34, -3.0, 4.0, -2.0, 6.0], [5, 4.0, 4.0, 4.0, 4.0], [11, -2.0, 2.0, 1.0, 3.0], [12, -3.0, 0.0, -1.0, 2.0], [31, -4.0, 4.0, -1.0, 5.0]], [31, 34, 31]], [[[31, 34]], 7]]], [[[[[4, 3.0, -3.0, 3.0, -1.0], [19, -1.0, -2.0, 2.0, 0.0], [38, -2.0, 1.0, 1.0, 1.0], [32, -4.0, 1.0, -3.0, 2.0]], [4, 19, 4, 32]], [[], 6]], [[[[35, 3.0, 3.0, 5.0, 3.0], [38, 4.0, -4.0, 4.0, -1.0], [33, -5.0, -3.0, -5.0, -3.0], [10, 0.0, 3.0, 1.0, 5.0], [22, -4.0, 1.0, -1.0, 3.0]], [33, 10, 38, 22]], [[], 10]], [[[[18, -4.0, 2.0, -4.0, 4.0], [30, 5.0, 5.0, 5.0, 6.0], [7, -5.0, 5.0, -3.0, 7.0], [32, -4.0, 2.0, -2.0, 4.0], [12, -2.0, 3.0, -2.0, 3.0]], [30, 18, 12, 32, 18]], [[[12, 32], [18, 32]], 10]], [[[[20, -3.0, -4.0, -3.0, -1.0], [37, 4.0, -4.0, 7.0, -4.0], [14, 3.0, -5.0, 5.0, -5.0], [39, -5.0, 3.0, -5.0, 4.0]], [39, 37, 20, 39]], [[], 6]], [[[[21, -4.0, -3.0, -2.0, -2.0], [3, 1.0, 3.0, 3.0, 5.0]], [3]], [[], 1]], [[[[35, 2.0, -1.0, 5.0, 1.0], [31, 0.0, 2.0, 2.0, 3.0], [1, -2.0, -1.0, 0.0, 2.0], [18, 0.0, -5.0, 2.0, -4.0], [19, -5.0, 3.0, -2.0, 5.0], [9, -2.0, 2.0, 0.0, 2.0], [11, -4.0, -2.0, -4.0, -1.0], [15, -5.0, 4.0, -5.0, 6.0], [6, -1.0, -3.0, -1.0, -2.0]], [9, 15, 19, 18, 31]], [[[1, 9], [1, 31], [9, 31], [15, 19]], 30]], [[[[9, 2.0, 4.0, 2.0, 5.0], [16, 3.0, -4.0, 3.0, -1.0], [37, 0.0, -5.0, 2.0, -5.0], [23, -5.0, -1.0, -5.0, 1.0], [33, 0.0, -3.0, 1.0, -3.0], [12, 1.0, 3.0, 1.0, 5.0], [17, 1.0, -3.0, 3.0, -2.0], [7, 1.0, 0.0, 1.0, 2.0]], [33, 37, 7]], [[[17, 33]], 18]], [[[[6, 3.0, 1.0, 5.0, 2.0], [27, -1.0, -4.0, 2.0, -1.0], [34, 2.0, 3.0, 2.0, 5.0], [11, -2.0, 2.0, -2.0, 3.0], [1, -5.0, -2.0, -4.0, 0.0]], [11, 6]], [[], 7]]], [[[[[33, -1.0, -1.0, 2.0, 2.0], [39, 3.0, -4.0, 6.0, -1.0], [3, 4.0, -4.0, 4.0, -4.0], [24, 5.0, -2.0, 5.0, -2.0], [38, 0.0, -5.0, 2.0, -2.0]], [39, 39, 39, 38, 39]], [[[3, 39], [24, 39]], 7]], [[[[14, 3.0, 3.0, 4.0, 3.0], [12, 4.0, -1.0, 7.0, -1.0], [16, -4.0, 3.0, -2.0, 5.0], [19, 3.0, -5.0, 3.0, -5.0], [9, 1.0, -1.0, 3.0, 0.0]], [16, 12, 16, 19, 12]], [[], 9]], [[[[33, 3.0, -2.0, 6.0, -1.0], [30, 0.0, 1.0, 2.0, 1.0], [3, -3.0, 5.0, -3.0, 5.0], [34, -3.0, 1.0, -1.0, 1.0], [1, -1.0, 2.0, 0.0, 5.0], [28, 2.0, -1.0, 5.0, -1.0], [16, 3.0, 4.0, 4.0, 7.0], [17, -1.0, 3.0, 1.0, 6.0], [15, -2.0, 4.0, -1.0, 4.0], [11, -4.0, 0.0, -4.0, 0.0], [12, 3.0, -1.0, 3.0, 0.0]], [15, 17, 33]], [[[1, 15], [1, 17], [12, 33], [15, 17], [28, 33]], 27]], [[[[27, -3.0, 5.0, -1.0, 6.0], [21, -5.0, 1.0, -5.0, 1.0], [12, 3.0, -1.0, 4.0, 0.0]], [12, 21, 21, 21]], [[], 3]], [[[[39, -5.0, -5.0, -3.0, -3.0], [11, 4.0, -4.0, 5.0, -2.0]], [39]], [[], 1]], [[[[7, -4.0, -3.0, -1.0, -3.0], [14, -4.0, 4.0, -3.0, 4.0], [12, 4.0, 4.0, 4.0, 4.0], [15, -5.0, 4.0, -4.0, 4.0], [6, 2.0, 0.0, 5.0, 3.0], [31, -5.0, -5.0, -3.0, -5.0], [17, -5.0, -5.0, -3.0, -3.0], [5, -3.0, -4.0, 0.0, -2.0], [9, -2.0, 0.0, -1.0, 1.0], [32, -4.0, 0.0, -1.0, 3.0]], [12, 15, 32, 17]], [[[5, 17], [7, 17], [9, 32], [14, 15], [17, 31]], 30]], [[[[33, 3.0, -3.0, 5.0, 0.0], [6, -3.0, -5.0, -2.0, -2.0], [23, 4.0, 4.0, 6.0, 5.0], [37, 5.0, 1.0, 8.0, 2.0], [8, 0.0, 1.0, 2.0, 4.0], [22, -3.0, 3.0, 0.0, 6.0], [27, 1.0, 0.0, 1.0, 1.0]], [22, 6, 8]], [[[8, 22], [8, 27]], 15]], [[[[11, -3.0, -3.0, 0.0, -1.0], [32, 1.0, -1.0, 2.0, 1.0], [16, 5.0, 4.0, 7.0, 4.0], [29, -1.0, 1.0, 1.0, 2.0], [36, 5.0, 2.0, 6.0, 2.0]], [36, 16, 16, 11, 36]], [[], 9]]]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check("case %d" % i, 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 |
|---|---|---|---|
| case 0 | [[], 4] | [[], 4] | Passed |
| case 1 | [[[12, 37], [12, 39]], 9] | [[[12, 37], [12, 39]], 9] | Passed |
| case 2 | [[], 5] | [[], 5] | Passed |
| case 3 | [[[18, 30], [25, 35], [34, 35]], 18] | [[[18, 30], [25, 35], [34, 35]], 18] | Passed |
| case 4 | [[], 1] | [[], 1] | Passed |
| case 5 | [[[16, 22], [22, 37]], 5] | [[[16, 22], [22, 37]], 5] | Passed |
| case 6 | [[], 12] | [[], 12] | Passed |
| case 7 | [[[9, 38]], 11] | [[[9, 38]], 11] | Passed |
SHA-256 / ba7fc9cbe5092aa9f3f699dccc05800be41b717c0d39596830e91de1d9d59588
Verification & scope
A deterministic bounded teaching model with stipulated toy conventions; not a production physics engine or spatial index. 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:51:01.632367+00:00.
Case digest / b40b2ce2f6fb7ca8560e68e5f9d318a73841ea9af3b84eb7cfdc9b7b9c3f5eff