FA-94706 / Exam timetabling constraints / Open access
Repeated sitting rows consume extra seats · case 01
Duplicate registrations push a period over capacity.
ROOT CAUSE
Rows are not deduplicated by student and exam.
VERIFIED REPAIR
Count each (student, exam) once.
Unsuccessful approach: Deduplicating by student and period drops a clashing second exam's seat.
Case contract
sits [student, exam, period, access]; cap period -> seats (missing = 0); mode exam -> paper/online (missing = paper). Each distinct (student, exam) uses one seat, two with an access arrangement, and none for online exams. Return [period, used, capacity] for periods over capacity, by period.
Why this case matters
Seat capacity per period is a hard constraint on which periods can take large exams.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sits, cap, mode):
seen = set()
used = {}
for st, ex, p, acc in sits:
seen.add((st, ex))
if mode.get(ex) == 'online':
continue
used[p] = used.get(p, 0) + (2 if acc else 1)
return [[p, used[p], cap.get(p, 0)] for p in sorted(used) if used[p] > cap.get(p, 0)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: duplicate sitting rows 1',
[[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('regression variant: duplicate sitting rows 2',
[[['s2', 'PHYS110', 0, False], ['s1', 'BIO130', 2, True], ['s1', 'BIO130', 2, True]], {0: 4, 1: 3, 2: 3},
{'MATH101': 'online', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s5', 'BIO130', 1, False], ['s3', 'BIO130', 1, False], ['s5', 'PHYS110', 1, False],
['s3', 'BIO130', 2, False], ['s4', 'BIO130', 2, False]],
{0: 3, 1: 1, 2: 2}, {'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[[1, 3, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('normal control 5',
[[['s4', 'CHEM120', 1, False], ['s5', 'CHEM120', 2, False], ['s1', 'MATH101', 2, True],
['s4', 'PHYS110', 1, False], ['s2', 'MATH101', 0, False], ['s4', 'CHEM120', 0, False],
['s2', 'MATH101H', 2, True], ['s5', 'MATH101', 0, True], ['s4', 'CHEM120', 0, False]],
{0: 3, 1: 4, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 6',
[[['s4', 'MATH101H', 2, False], ['s1', 'MATH101', 1, False], ['s5', 'MATH101', 1, False],
['s1', 'MATH101H', 0, False], ['s2', 'MATH101H', 2, False], ['s5', 'CHEM120', 0, True]],
{0: 3, 1: 1, 2: 2}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[1, 2, 1]]),
('normal control 7',
[[['s1', 'BIO130', 2, False], ['s3', 'PHYS110', 1, False], ['s3', 'BIO130', 2, False],
['s1', 'BIO130', 1, False], ['s1', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s5', 'BIO130', 1, False], ['s1', 'MATH101H', 2, True], ['s5', 'CHEM120', 1, False],
['s1', 'MATH101', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 4, 2]]),
('normal control 8',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s3', 'BIO130', 0, False], ['s3', 'PHYS110', 2, True], ['s1', 'MATH101H', 1, False],
['s1', 'MATH101H', 1, True], ['s1', 'PHYS110', 1, False], ['s3', 'BIO130', 0, False]],
{1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s3', 'CHEM120', 2, False], ['s2', 'PHYS110', 0, False], ['s3', 'PHYS110', 2, False],
['s2', 'BIO130', 1, False], ['s1', 'MATH101H', 2, False], ['s4', 'CHEM120', 2, False],
['s4', 'CHEM120', 1, True], ['s5', 'MATH101H', 0, False], ['s1', 'MATH101H', 0, False],
['s2', 'PHYS110', 0, False]],
{0: 2, 1: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[2, 4, 0]]),
('boundary control 3', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 5',
[[['s1', 'BIO130', 2, False], ['s3', 'PHYS110', 1, False], ['s3', 'BIO130', 2, False],
['s1', 'BIO130', 1, False], ['s1', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s5', 'BIO130', 1, False], ['s1', 'MATH101H', 2, True], ['s5', 'CHEM120', 1, False],
['s1', 'MATH101', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 4, 2]]),
('normal control 6',
[[['s2', 'BIO130', 0, False], ['s2', 'MATH101', 1, False], ['s4', 'CHEM120', 2, True],
['s5', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, True]],
{2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [1, 2, 0], [2, 3, 2]]),
('normal control 7',
[[['s3', 'MATH101', 1, False], ['s5', 'PHYS110', 1, True], ['s2', 'PHYS110', 0, False],
['s1', 'PHYS110', 1, False], ['s1', 'PHYS110', 1, True], ['s3', 'PHYS110', 0, False]],
{0: 1, 1: 2, 2: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [1, 3, 2]]),
('normal control 8',
[[['s2', 'BIO130', 1, True], ['s4', 'MATH101', 1, False], ['s4', 'MATH101H', 1, True],
['s5', 'MATH101H', 1, True], ['s5', 'PHYS110', 1, False], ['s4', 'MATH101', 2, False],
['s1', 'BIO130', 0, False]],
{1: 3, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[[0, 1, 0], [1, 7, 3]])],
[('regression: duplicate sitting rows 1',
[[['s4', 'MATH101H', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'CHEM120', 2, False],
['s5', 'CHEM120', 2, True], ['s4', 'BIO130', 2, True], ['s1', 'PHYS110', 1, False],
['s4', 'MATH101', 1, False], ['s2', 'PHYS110', 2, True], ['s5', 'CHEM120', 1, False],
['s5', 'MATH101H', 2, False]],
{0: 2, 1: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1], [2, 6, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s1', 'MATH101', 0, False], ['s1', 'CHEM120', 1, False], ['s1', 'MATH101', 0, False]], {1: 4, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101H', 2, False], ['s3', 'CHEM120', 2, True], ['s4', 'MATH101', 0, False],
['s2', 'PHYS110', 2, False], ['s2', 'CHEM120', 2, True]],
{1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [2, 5, 4]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s1', 'CHEM120', 1, False], ['s4', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, False]],
{0: 4, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[]),
('normal control 8',
[[['s1', 'MATH101', 1, False], ['s5', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, True],
['s2', 'MATH101', 0, False], ['s3', 'BIO130', 1, False], ['s1', 'MATH101', 1, False]],
{0: 4, 1: 4, 2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s3', 'MATH101H', 2, False], ['s3', 'MATH101H', 0, False], ['s5', 'PHYS110', 0, False],
['s2', 'MATH101H', 0, False], ['s4', 'MATH101H', 0, False], ['s3', 'PHYS110', 1, False],
['s2', 'MATH101', 1, False], ['s5', 'PHYS110', 0, False], ['s4', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, True]],
{0: 1, 2: 1},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 1], [1, 1, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 2, False], ['s2', 'MATH101H', 2, False],
['s5', 'BIO130', 2, False], ['s2', 'PHYS110', 0, False], ['s4', 'MATH101', 1, False],
['s4', 'PHYS110', 0, False], ['s5', 'MATH101', 0, False], ['s4', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False]],
{0: 1, 1: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [2, 3, 0]]),
('partial repair guard 3',
[[['s4', 'PHYS110', 1, False], ['s4', 'BIO130', 1, False], ['s5', 'BIO130', 1, False],
['s5', 'BIO130', 1, False]],
{0: 3, 1: 1}, {'MATH101': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s3', 'BIO130', 2, False], ['s1', 'MATH101H', 0, False], ['s5', 'BIO130', 0, False],
['s4', 'PHYS110', 0, False], ['s2', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s3', 'BIO130', 2, False]],
{0: 3, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s4', 'PHYS110', 0, False], ['s1', 'BIO130', 1, False], ['s1', 'MATH101H', 0, False],
['s5', 'BIO130', 0, False], ['s4', 'CHEM120', 2, False], ['s4', 'CHEM120', 2, False]],
{0: 3, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 8',
[[['s2', 'MATH101', 2, False], ['s4', 'BIO130', 1, True], ['s4', 'CHEM120', 0, True],
['s2', 'MATH101', 2, False], ['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 2, False],
['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 1, False]],
{0: 2, 1: 4, 2: 3}, {'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s1', 'BIO130', 0, False], ['s1', 'PHYS110', 0, True], ['s5', 'CHEM120', 1, False],
['s1', 'BIO130', 0, False], ['s2', 'CHEM120', 2, False], ['s1', 'BIO130', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('regression variant: duplicate sitting rows 2',
[[['s3', 'BIO130', 2, False], ['s4', 'MATH101', 2, True], ['s4', 'MATH101H', 0, True],
['s2', 'PHYS110', 2, False], ['s4', 'MATH101', 2, False], ['s5', 'PHYS110', 1, False],
['s2', 'PHYS110', 2, False]],
{0: 2, 1: 2},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 3, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 1, False], ['s2', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False], ['s3', 'MATH101', 1, False], ['s1', 'MATH101H', 2, True],
['s5', 'PHYS110', 0, False], ['s5', 'CHEM120', 2, False], ['s2', 'MATH101', 2, False],
['s2', 'PHYS110', 0, False], ['s5', 'PHYS110', 0, False]],
{0: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online'}],
[[1, 3, 0], [2, 4, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s4', 'BIO130', 2, False], ['s3', 'BIO130', 2, True], ['s4', 'BIO130', 2, False]], {0: 4, 1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'PHYS110', 2, False], ['s4', 'MATH101', 0, False], ['s5', 'MATH101H', 2, True],
['s2', 'CHEM120', 2, False], ['s1', 'BIO130', 0, False], ['s2', 'BIO130', 0, False],
['s2', 'PHYS110', 2, True], ['s1', 'CHEM120', 1, False], ['s1', 'CHEM120', 1, False],
['s4', 'BIO130', 0, False]],
{0: 4, 1: 2, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[2, 6, 3]]),
('normal control 8',
[[['s2', 'PHYS110', 2, False], ['s4', 'CHEM120', 0, True], ['s2', 'PHYS110', 0, True]], {1: 3, 2: 3},
{'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper'}],
[[0, 2, 0]])]]
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: duplicate sitting rows 1 | [[0, 2, 1]] | [] | Failed |
| regression variant: duplicate sitting rows 2 | [[2, 4, 3]] | [] | Failed |
| partial repair guard 3 | [[1, 3, 1]] | [[1, 3, 1]] | Passed |
| boundary control 4 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| normal control 5 | [[0, 5, 3]] | [] | Failed |
| normal control 6 | [[1, 2, 1]] | [[1, 2, 1]] | Passed |
| normal control 7 | [[2, 4, 2]] | [[2, 4, 2]] | Passed |
| normal control 8 | [] | [] | Passed |
SHA-256 / 0209407035478e1f9b0cf895e8df2185cda45ea1e6c8fe6e7f9f2e2c222bd873
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sits, cap, mode):
seen = set()
used = {}
for st, ex, p, acc in sits:
if (st, p) in seen:
continue
seen.add((st, p))
if mode.get(ex) == 'online':
continue
used[p] = used.get(p, 0) + (2 if acc else 1)
return [[p, used[p], cap.get(p, 0)] for p in sorted(used) if used[p] > cap.get(p, 0)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: duplicate sitting rows 1',
[[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('regression variant: duplicate sitting rows 2',
[[['s2', 'PHYS110', 0, False], ['s1', 'BIO130', 2, True], ['s1', 'BIO130', 2, True]], {0: 4, 1: 3, 2: 3},
{'MATH101': 'online', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s5', 'BIO130', 1, False], ['s3', 'BIO130', 1, False], ['s5', 'PHYS110', 1, False],
['s3', 'BIO130', 2, False], ['s4', 'BIO130', 2, False]],
{0: 3, 1: 1, 2: 2}, {'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[[1, 3, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('normal control 5',
[[['s4', 'CHEM120', 1, False], ['s5', 'CHEM120', 2, False], ['s1', 'MATH101', 2, True],
['s4', 'PHYS110', 1, False], ['s2', 'MATH101', 0, False], ['s4', 'CHEM120', 0, False],
['s2', 'MATH101H', 2, True], ['s5', 'MATH101', 0, True], ['s4', 'CHEM120', 0, False]],
{0: 3, 1: 4, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 6',
[[['s4', 'MATH101H', 2, False], ['s1', 'MATH101', 1, False], ['s5', 'MATH101', 1, False],
['s1', 'MATH101H', 0, False], ['s2', 'MATH101H', 2, False], ['s5', 'CHEM120', 0, True]],
{0: 3, 1: 1, 2: 2}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[1, 2, 1]]),
('normal control 7',
[[['s1', 'BIO130', 2, False], ['s3', 'PHYS110', 1, False], ['s3', 'BIO130', 2, False],
['s1', 'BIO130', 1, False], ['s1', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s5', 'BIO130', 1, False], ['s1', 'MATH101H', 2, True], ['s5', 'CHEM120', 1, False],
['s1', 'MATH101', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 4, 2]]),
('normal control 8',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s3', 'BIO130', 0, False], ['s3', 'PHYS110', 2, True], ['s1', 'MATH101H', 1, False],
['s1', 'MATH101H', 1, True], ['s1', 'PHYS110', 1, False], ['s3', 'BIO130', 0, False]],
{1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s3', 'CHEM120', 2, False], ['s2', 'PHYS110', 0, False], ['s3', 'PHYS110', 2, False],
['s2', 'BIO130', 1, False], ['s1', 'MATH101H', 2, False], ['s4', 'CHEM120', 2, False],
['s4', 'CHEM120', 1, True], ['s5', 'MATH101H', 0, False], ['s1', 'MATH101H', 0, False],
['s2', 'PHYS110', 0, False]],
{0: 2, 1: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[2, 4, 0]]),
('boundary control 3', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 5',
[[['s1', 'BIO130', 2, False], ['s3', 'PHYS110', 1, False], ['s3', 'BIO130', 2, False],
['s1', 'BIO130', 1, False], ['s1', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s5', 'BIO130', 1, False], ['s1', 'MATH101H', 2, True], ['s5', 'CHEM120', 1, False],
['s1', 'MATH101', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 4, 2]]),
('normal control 6',
[[['s2', 'BIO130', 0, False], ['s2', 'MATH101', 1, False], ['s4', 'CHEM120', 2, True],
['s5', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, True]],
{2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [1, 2, 0], [2, 3, 2]]),
('normal control 7',
[[['s3', 'MATH101', 1, False], ['s5', 'PHYS110', 1, True], ['s2', 'PHYS110', 0, False],
['s1', 'PHYS110', 1, False], ['s1', 'PHYS110', 1, True], ['s3', 'PHYS110', 0, False]],
{0: 1, 1: 2, 2: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [1, 3, 2]]),
('normal control 8',
[[['s2', 'BIO130', 1, True], ['s4', 'MATH101', 1, False], ['s4', 'MATH101H', 1, True],
['s5', 'MATH101H', 1, True], ['s5', 'PHYS110', 1, False], ['s4', 'MATH101', 2, False],
['s1', 'BIO130', 0, False]],
{1: 3, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[[0, 1, 0], [1, 7, 3]])],
[('regression: duplicate sitting rows 1',
[[['s4', 'MATH101H', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'CHEM120', 2, False],
['s5', 'CHEM120', 2, True], ['s4', 'BIO130', 2, True], ['s1', 'PHYS110', 1, False],
['s4', 'MATH101', 1, False], ['s2', 'PHYS110', 2, True], ['s5', 'CHEM120', 1, False],
['s5', 'MATH101H', 2, False]],
{0: 2, 1: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1], [2, 6, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s1', 'MATH101', 0, False], ['s1', 'CHEM120', 1, False], ['s1', 'MATH101', 0, False]], {1: 4, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101H', 2, False], ['s3', 'CHEM120', 2, True], ['s4', 'MATH101', 0, False],
['s2', 'PHYS110', 2, False], ['s2', 'CHEM120', 2, True]],
{1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [2, 5, 4]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s1', 'CHEM120', 1, False], ['s4', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, False]],
{0: 4, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[]),
('normal control 8',
[[['s1', 'MATH101', 1, False], ['s5', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, True],
['s2', 'MATH101', 0, False], ['s3', 'BIO130', 1, False], ['s1', 'MATH101', 1, False]],
{0: 4, 1: 4, 2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s3', 'MATH101H', 2, False], ['s3', 'MATH101H', 0, False], ['s5', 'PHYS110', 0, False],
['s2', 'MATH101H', 0, False], ['s4', 'MATH101H', 0, False], ['s3', 'PHYS110', 1, False],
['s2', 'MATH101', 1, False], ['s5', 'PHYS110', 0, False], ['s4', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, True]],
{0: 1, 2: 1},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 1], [1, 1, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 2, False], ['s2', 'MATH101H', 2, False],
['s5', 'BIO130', 2, False], ['s2', 'PHYS110', 0, False], ['s4', 'MATH101', 1, False],
['s4', 'PHYS110', 0, False], ['s5', 'MATH101', 0, False], ['s4', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False]],
{0: 1, 1: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [2, 3, 0]]),
('partial repair guard 3',
[[['s4', 'PHYS110', 1, False], ['s4', 'BIO130', 1, False], ['s5', 'BIO130', 1, False],
['s5', 'BIO130', 1, False]],
{0: 3, 1: 1}, {'MATH101': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s3', 'BIO130', 2, False], ['s1', 'MATH101H', 0, False], ['s5', 'BIO130', 0, False],
['s4', 'PHYS110', 0, False], ['s2', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s3', 'BIO130', 2, False]],
{0: 3, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s4', 'PHYS110', 0, False], ['s1', 'BIO130', 1, False], ['s1', 'MATH101H', 0, False],
['s5', 'BIO130', 0, False], ['s4', 'CHEM120', 2, False], ['s4', 'CHEM120', 2, False]],
{0: 3, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 8',
[[['s2', 'MATH101', 2, False], ['s4', 'BIO130', 1, True], ['s4', 'CHEM120', 0, True],
['s2', 'MATH101', 2, False], ['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 2, False],
['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 1, False]],
{0: 2, 1: 4, 2: 3}, {'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s1', 'BIO130', 0, False], ['s1', 'PHYS110', 0, True], ['s5', 'CHEM120', 1, False],
['s1', 'BIO130', 0, False], ['s2', 'CHEM120', 2, False], ['s1', 'BIO130', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('regression variant: duplicate sitting rows 2',
[[['s3', 'BIO130', 2, False], ['s4', 'MATH101', 2, True], ['s4', 'MATH101H', 0, True],
['s2', 'PHYS110', 2, False], ['s4', 'MATH101', 2, False], ['s5', 'PHYS110', 1, False],
['s2', 'PHYS110', 2, False]],
{0: 2, 1: 2},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 3, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 1, False], ['s2', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False], ['s3', 'MATH101', 1, False], ['s1', 'MATH101H', 2, True],
['s5', 'PHYS110', 0, False], ['s5', 'CHEM120', 2, False], ['s2', 'MATH101', 2, False],
['s2', 'PHYS110', 0, False], ['s5', 'PHYS110', 0, False]],
{0: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online'}],
[[1, 3, 0], [2, 4, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s4', 'BIO130', 2, False], ['s3', 'BIO130', 2, True], ['s4', 'BIO130', 2, False]], {0: 4, 1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'PHYS110', 2, False], ['s4', 'MATH101', 0, False], ['s5', 'MATH101H', 2, True],
['s2', 'CHEM120', 2, False], ['s1', 'BIO130', 0, False], ['s2', 'BIO130', 0, False],
['s2', 'PHYS110', 2, True], ['s1', 'CHEM120', 1, False], ['s1', 'CHEM120', 1, False],
['s4', 'BIO130', 0, False]],
{0: 4, 1: 2, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[2, 6, 3]]),
('normal control 8',
[[['s2', 'PHYS110', 2, False], ['s4', 'CHEM120', 0, True], ['s2', 'PHYS110', 0, True]], {1: 3, 2: 3},
{'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper'}],
[[0, 2, 0]])]]
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: duplicate sitting rows 1 | [] | [] | Passed |
| regression variant: duplicate sitting rows 2 | [] | [] | Passed |
| partial repair guard 3 | [[1, 2, 1]] | [[1, 3, 1]] | Failed |
| boundary control 4 | [] | [[0, 2, 1]] | Failed |
| normal control 5 | [[0, 4, 3]] | [] | Failed |
| normal control 6 | [[1, 2, 1]] | [[1, 2, 1]] | Passed |
| normal control 7 | [] | [[2, 4, 2]] | Failed |
| normal control 8 | [] | [] | Passed |
SHA-256 / a47914631c172b4662c97fcaa0b470559c47cc018320a4677278aa81b8a2855f
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(sits, cap, mode):
seen = set()
used = {}
for st, ex, p, acc in sits:
if (st, ex) in seen:
continue
seen.add((st, ex))
if mode.get(ex) == 'online':
continue
used[p] = used.get(p, 0) + (2 if acc else 1)
return [[p, used[p], cap.get(p, 0)] for p in sorted(used) if used[p] > cap.get(p, 0)]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: duplicate sitting rows 1',
[[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('regression variant: duplicate sitting rows 2',
[[['s2', 'PHYS110', 0, False], ['s1', 'BIO130', 2, True], ['s1', 'BIO130', 2, True]], {0: 4, 1: 3, 2: 3},
{'MATH101': 'online', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[]),
('partial repair guard 3',
[[['s5', 'BIO130', 1, False], ['s3', 'BIO130', 1, False], ['s5', 'PHYS110', 1, False],
['s3', 'BIO130', 2, False], ['s4', 'BIO130', 2, False]],
{0: 3, 1: 1, 2: 2}, {'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online'}],
[[1, 3, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('normal control 5',
[[['s4', 'CHEM120', 1, False], ['s5', 'CHEM120', 2, False], ['s1', 'MATH101', 2, True],
['s4', 'PHYS110', 1, False], ['s2', 'MATH101', 0, False], ['s4', 'CHEM120', 0, False],
['s2', 'MATH101H', 2, True], ['s5', 'MATH101', 0, True], ['s4', 'CHEM120', 0, False]],
{0: 3, 1: 4, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 6',
[[['s4', 'MATH101H', 2, False], ['s1', 'MATH101', 1, False], ['s5', 'MATH101', 1, False],
['s1', 'MATH101H', 0, False], ['s2', 'MATH101H', 2, False], ['s5', 'CHEM120', 0, True]],
{0: 3, 1: 1, 2: 2}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[[1, 2, 1]]),
('normal control 7',
[[['s1', 'BIO130', 2, False], ['s3', 'PHYS110', 1, False], ['s3', 'BIO130', 2, False],
['s1', 'BIO130', 1, False], ['s1', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s5', 'BIO130', 1, False], ['s1', 'MATH101H', 2, True], ['s5', 'CHEM120', 1, False],
['s1', 'MATH101', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 4, 2]]),
('normal control 8',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s3', 'BIO130', 0, False], ['s3', 'PHYS110', 2, True], ['s1', 'MATH101H', 1, False],
['s1', 'MATH101H', 1, True], ['s1', 'PHYS110', 1, False], ['s3', 'BIO130', 0, False]],
{1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s3', 'CHEM120', 2, False], ['s2', 'PHYS110', 0, False], ['s3', 'PHYS110', 2, False],
['s2', 'BIO130', 1, False], ['s1', 'MATH101H', 2, False], ['s4', 'CHEM120', 2, False],
['s4', 'CHEM120', 1, True], ['s5', 'MATH101H', 0, False], ['s1', 'MATH101H', 0, False],
['s2', 'PHYS110', 0, False]],
{0: 2, 1: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[2, 4, 0]]),
('boundary control 3', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 5',
[[['s1', 'BIO130', 2, False], ['s3', 'PHYS110', 1, False], ['s3', 'BIO130', 2, False],
['s1', 'BIO130', 1, False], ['s1', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s5', 'BIO130', 1, False], ['s1', 'MATH101H', 2, True], ['s5', 'CHEM120', 1, False],
['s1', 'MATH101', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 4, 2]]),
('normal control 6',
[[['s2', 'BIO130', 0, False], ['s2', 'MATH101', 1, False], ['s4', 'CHEM120', 2, True],
['s5', 'MATH101H', 2, False], ['s4', 'PHYS110', 1, True]],
{2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [1, 2, 0], [2, 3, 2]]),
('normal control 7',
[[['s3', 'MATH101', 1, False], ['s5', 'PHYS110', 1, True], ['s2', 'PHYS110', 0, False],
['s1', 'PHYS110', 1, False], ['s1', 'PHYS110', 1, True], ['s3', 'PHYS110', 0, False]],
{0: 1, 1: 2, 2: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [1, 3, 2]]),
('normal control 8',
[[['s2', 'BIO130', 1, True], ['s4', 'MATH101', 1, False], ['s4', 'MATH101H', 1, True],
['s5', 'MATH101H', 1, True], ['s5', 'PHYS110', 1, False], ['s4', 'MATH101', 2, False],
['s1', 'BIO130', 0, False]],
{1: 3, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'CHEM120': 'paper'}],
[[0, 1, 0], [1, 7, 3]])],
[('regression: duplicate sitting rows 1',
[[['s4', 'MATH101H', 1, False], ['s4', 'MATH101', 1, False], ['s5', 'CHEM120', 2, False],
['s5', 'CHEM120', 2, True], ['s4', 'BIO130', 2, True], ['s1', 'PHYS110', 1, False],
['s4', 'MATH101', 1, False], ['s2', 'PHYS110', 2, True], ['s5', 'CHEM120', 1, False],
['s5', 'MATH101H', 2, False]],
{0: 2, 1: 1},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1], [2, 6, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s1', 'MATH101', 0, False], ['s1', 'CHEM120', 1, False], ['s1', 'MATH101', 0, False]], {1: 4, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online', 'BIO130': 'paper'}],
[[0, 1, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101H', 2, False], ['s3', 'CHEM120', 2, True], ['s4', 'MATH101', 0, False],
['s2', 'PHYS110', 2, False], ['s2', 'CHEM120', 2, True]],
{1: 2, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[0, 1, 0], [2, 5, 4]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s1', 'CHEM120', 1, False], ['s4', 'PHYS110', 0, False], ['s4', 'PHYS110', 0, False]],
{0: 4, 1: 2, 2: 4}, {'MATH101H': 'paper', 'CHEM120': 'online', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s2', 'CHEM120', 1, False], ['s4', 'PHYS110', 2, False], ['s5', 'MATH101', 0, False]],
{0: 4, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'paper', 'BIO130': 'online'}],
[]),
('normal control 8',
[[['s1', 'MATH101', 1, False], ['s5', 'PHYS110', 1, False], ['s3', 'MATH101H', 0, True],
['s2', 'MATH101', 0, False], ['s3', 'BIO130', 1, False], ['s1', 'MATH101', 1, False]],
{0: 4, 1: 4, 2: 2}, {'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'BIO130': 'paper'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s3', 'MATH101H', 2, False], ['s3', 'MATH101H', 0, False], ['s5', 'PHYS110', 0, False],
['s2', 'MATH101H', 0, False], ['s4', 'MATH101H', 0, False], ['s3', 'PHYS110', 1, False],
['s2', 'MATH101', 1, False], ['s5', 'PHYS110', 0, False], ['s4', 'CHEM120', 0, False],
['s3', 'MATH101H', 1, True]],
{0: 1, 2: 1},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'online'}],
[[0, 2, 1], [1, 1, 0]]),
('regression variant: duplicate sitting rows 2',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 2, False], ['s2', 'MATH101H', 2, False],
['s5', 'BIO130', 2, False], ['s2', 'PHYS110', 0, False], ['s4', 'MATH101', 1, False],
['s4', 'PHYS110', 0, False], ['s5', 'MATH101', 0, False], ['s4', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False]],
{0: 1, 1: 4},
{'MATH101': 'online', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[0, 2, 1], [2, 3, 0]]),
('partial repair guard 3',
[[['s4', 'PHYS110', 1, False], ['s4', 'BIO130', 1, False], ['s5', 'BIO130', 1, False],
['s5', 'BIO130', 1, False]],
{0: 3, 1: 1}, {'MATH101': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[1, 3, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 2}, {'A': 'paper'}], []),
('boundary control 5', [[['s1', 'A', 0, False], ['s2', 'A', 0, False]], {0: 1}, {'A': 'online'}], []),
('normal control 6',
[[['s3', 'BIO130', 2, False], ['s1', 'MATH101H', 0, False], ['s5', 'BIO130', 0, False],
['s4', 'PHYS110', 0, False], ['s2', 'MATH101', 0, False], ['s2', 'BIO130', 0, True],
['s3', 'BIO130', 2, False]],
{0: 3, 1: 4, 2: 3}, {'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[]),
('normal control 7',
[[['s4', 'PHYS110', 0, False], ['s1', 'BIO130', 1, False], ['s1', 'MATH101H', 0, False],
['s5', 'BIO130', 0, False], ['s4', 'CHEM120', 2, False], ['s4', 'CHEM120', 2, False]],
{0: 3, 1: 1, 2: 4},
{'MATH101': 'online', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('normal control 8',
[[['s2', 'MATH101', 2, False], ['s4', 'BIO130', 1, True], ['s4', 'CHEM120', 0, True],
['s2', 'MATH101', 2, False], ['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 2, False],
['s4', 'MATH101H', 0, False], ['s5', 'CHEM120', 1, False]],
{0: 2, 1: 4, 2: 3}, {'MATH101H': 'online', 'PHYS110': 'paper', 'BIO130': 'online'}],
[])],
[('regression: duplicate sitting rows 1',
[[['s1', 'BIO130', 0, False], ['s1', 'PHYS110', 0, True], ['s5', 'CHEM120', 1, False],
['s1', 'BIO130', 0, False], ['s2', 'CHEM120', 2, False], ['s1', 'BIO130', 0, False]],
{0: 3, 1: 4, 2: 2},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[]),
('regression variant: duplicate sitting rows 2',
[[['s3', 'BIO130', 2, False], ['s4', 'MATH101', 2, True], ['s4', 'MATH101H', 0, True],
['s2', 'PHYS110', 2, False], ['s4', 'MATH101', 2, False], ['s5', 'PHYS110', 1, False],
['s2', 'PHYS110', 2, False]],
{0: 2, 1: 2},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'online', 'CHEM120': 'online', 'BIO130': 'paper'}],
[[2, 3, 0]]),
('partial repair guard 3',
[[['s1', 'MATH101', 0, False], ['s3', 'MATH101H', 1, False], ['s2', 'CHEM120', 1, False],
['s3', 'MATH101H', 2, False], ['s3', 'MATH101', 1, False], ['s1', 'MATH101H', 2, True],
['s5', 'PHYS110', 0, False], ['s5', 'CHEM120', 2, False], ['s2', 'MATH101', 2, False],
['s2', 'PHYS110', 0, False], ['s5', 'PHYS110', 0, False]],
{0: 2, 2: 1}, {'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'online'}],
[[1, 3, 0], [2, 4, 1]]),
('boundary control 4', [[['s1', 'A', 0, False], ['s1', 'B', 0, False]], {0: 1}, {}], [[0, 2, 1]]),
('boundary control 5', [[['s1', 'A', 0, False], ['s1', 'A', 0, False]], {0: 1}, {'A': 'paper'}], []),
('normal control 6',
[[['s4', 'BIO130', 2, False], ['s3', 'BIO130', 2, True], ['s4', 'BIO130', 2, False]], {0: 4, 1: 3, 2: 4},
{'MATH101': 'paper', 'MATH101H': 'online', 'PHYS110': 'paper', 'CHEM120': 'online', 'BIO130': 'paper'}],
[]),
('normal control 7',
[[['s5', 'PHYS110', 2, False], ['s4', 'MATH101', 0, False], ['s5', 'MATH101H', 2, True],
['s2', 'CHEM120', 2, False], ['s1', 'BIO130', 0, False], ['s2', 'BIO130', 0, False],
['s2', 'PHYS110', 2, True], ['s1', 'CHEM120', 1, False], ['s1', 'CHEM120', 1, False],
['s4', 'BIO130', 0, False]],
{0: 4, 1: 2, 2: 3},
{'MATH101': 'paper', 'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper', 'BIO130': 'paper'}],
[[2, 6, 3]]),
('normal control 8',
[[['s2', 'PHYS110', 2, False], ['s4', 'CHEM120', 0, True], ['s2', 'PHYS110', 0, True]], {1: 3, 2: 3},
{'MATH101H': 'paper', 'PHYS110': 'paper', 'CHEM120': 'paper'}],
[[0, 2, 0]])]]
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: duplicate sitting rows 1 | [] | [] | Passed |
| regression variant: duplicate sitting rows 2 | [] | [] | Passed |
| partial repair guard 3 | [[1, 3, 1]] | [[1, 3, 1]] | Passed |
| boundary control 4 | [[0, 2, 1]] | [[0, 2, 1]] | Passed |
| normal control 5 | [] | [] | Passed |
| normal control 6 | [[1, 2, 1]] | [[1, 2, 1]] | Passed |
| normal control 7 | [[2, 4, 2]] | [[2, 4, 2]] | Passed |
| normal control 8 | [] | [] | Passed |
SHA-256 / 724c20febe74ebe9c04e150e4685df0d0052be5ce1459ac23216de4f33cb3aed
Verification & scope
Stipulated toy exam-timetabling rule set for a bounded model; it does not claim conformance with any institution's regulations or a benchmark specification, and it performs no search or optimisation. 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:52:06.820907+00:00.
Case digest / 10d702b7a2781ced94ea841bf74c7222d888d0b659a78d0452da3323d497cb0b