FA-68101 / Traffic signal timing plans / Open access
Time-of-day plan schedule: carryover takes the earliest event of the previous day · case 01
Time-of-day plan schedule returns a wrong result when carryover takes the earliest event of the previous day.
ROOT CAUSE
The morning event of the previous day is chosen instead of the last event still in effect overnight.
VERIFIED REPAIR
Restore the carryover event choice rule so that the step reads `sorted(cand, key=lambda c: c[0])[-1][1]`.
Unsuccessful approach: Taking the last listed event assumes the table is sorted by start time.
Case contract
Input {events: [[day mask (bit0 = Sunday), 'HH:MM', plan]], holidays: [[month, day, as_dow]], now: [dow, 'HH:MM', month, day]}. A holiday makes today's events come from its as_dow day type. The active plan is the event for today with the latest start <= now (later-listed wins at equal start). If none, the latest event of the most recent earlier real weekday that has events (up to 7 days back, same tie rule). Otherwise 'free'.
Why this case matters
Signal timing arithmetic is exact and integer or rational; a wrong rule silently produces unsafe or inefficient timing plans.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def mins(s):
h, m = s.split(':')
return int(h) * 60 + int(m)
dow, hm, mo, dy = x['now']
t = mins(hm)
eff = dow
for hmo, hdy, as_dow in x['holidays']:
if hmo == mo and hdy == dy:
eff = as_dow
best = None
for mask, st, plan in x['events']:
if mask >> eff & 1 and mins(st) <= t:
if best is None or mins(st) >= best[0]:
best = (mins(st), plan)
if best is not None:
return best[1]
for back in range(1, 8):
d = (dow - back) % 7
cand = [(mins(st), plan) for mask, st, plan in x['events'] if mask >> d & 1]
if cand:
return sorted(cand, key=lambda c: c[0])[0][1]
return 'free'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[127, '13:15', 6], [65, '07:15', 9], [32, '07:45', 8], [46, '13:45', 6], [64, '21:30', 7], [1, '22:30', 3]], 'holidays': [[11, 26, 1]], 'now': [1, '10:45', 11, 26]}, 3), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[64, '21:00', 2], [65, '22:45', 1], [2, '12:15', 9], [2, '02:45', 9], [1, '05:45', 3], [2, '10:15', 2]], 'holidays': [[11, 13, 4]], 'now': [3, '08:07', 9, 11]}, 9), ({'events': [[127, '16:30', 9]], 'holidays': [], 'now': [2, '16:30', 3, 26]}, 9), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[96, '20:30', 8], [96, '05:45', 1]], 'holidays': [[4, 6, 0]], 'now': [0, '06:30', 4, 6]}, 8), ({'events': [[25, '06:00', 7], [3, '10:00', 6], [127, '21:45', 9]], 'holidays': [], 'now': [2, '06:00', 3, 8]}, 9)], [({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[96, '17:00', 9], [1, '18:00', 6], [2, '04:00', 4], [65, '10:45', 7], [96, '16:15', 5], [1, '10:45', 9]], 'holidays': [[9, 20, 4]], 'now': [3, '10:45', 9, 20]}, 4), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[65, '21:15', 8], [65, '18:45', 4], [1, '13:30', 1], [45, '12:15', 5]], 'holidays': [], 'now': [1, '02:15', 8, 18]}, 8), ({'events': [[23, '04:45', 7], [62, '23:15', 3], [65, '21:30', 1], [6, '12:00', 9]], 'holidays': [[2, 22, 2]], 'now': [3, '04:45', 2, 22]}, 7), ({'events': [[127, '19:15', 8], [2, '15:45', 9]], 'holidays': [[1, 11, 0]], 'now': [4, '22:07', 1, 11]}, 8), ({'events': [[59, '12:15', 6], [3, '21:30', 2], [44, '04:15', 3], [92, '04:15', 2], [37, '22:00', 1], [1, '02:00', 6]], 'holidays': [[5, 14, 1]], 'now': [1, '04:15', 8, 10]}, 1)], [({'events': [[49, '19:45', 4], [1, '17:30', 1], [3, '09:00', 7], [122, '11:00', 3]], 'holidays': [[2, 20, 6], [12, 24, 6]], 'now': [2, '19:45', 11, 23]}, 3), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[3, '05:00', 3], [25, '04:30', 6], [62, '17:00', 6]], 'holidays': [[1, 5, 4]], 'now': [0, '11:30', 1, 5]}, 6), ({'events': [[64, '13:00', 3], [3, '02:00', 9], [109, '16:15', 3], [52, '07:15', 7]], 'holidays': [[5, 14, 4]], 'now': [3, '13:00', 5, 14]}, 7), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[3, '05:15', 9], [64, '16:45', 8]], 'holidays': [[1, 1, 2], [2, 6, 0]], 'now': [1, '18:07', 2, 6]}, 9), ({'events': [[64, '16:45', 7], [107, '11:30', 5], [126, '09:00', 1], [1, '05:00', 1]], 'holidays': [[3, 15, 5], [4, 4, 5]], 'now': [1, '01:44', 3, 15]}, 5)], [({'events': [[127, '07:30', 2], [64, '13:00', 2], [65, '21:15', 1]], 'holidays': [[10, 24, 2], [12, 19, 3]], 'now': [1, '21:44', 10, 3]}, 2), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[96, '10:30', 9], [32, '02:00', 6], [2, '15:45', 5], [62, '18:45', 4], [47, '23:45', 3], [15, '19:15', 6]], 'holidays': [[6, 20, 2]], 'now': [3, '00:30', 9, 17]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '19:30', 5], [96, '19:15', 6], [3, '22:00', 1], [127, '02:00', 6], [127, '11:30', 3]], 'holidays': [], 'now': [6, '12:45', 9, 8]}, 3), ({'events': [[2, '20:30', 8], [1, '15:15', 6], [64, '08:00', 6], [125, '04:45', 1], [96, '11:15', 3]], 'holidays': [], 'now': [4, '22:30', 10, 18]}, 1), ({'events': [[2, '04:15', 7], [17, '08:15', 1], [34, '05:30', 1]], 'holidays': [[12, 6, 2], [4, 19, 3]], 'now': [3, '04:15', 12, 6]}, 1)], [({'events': [[3, '17:00', 4], [127, '11:00', 7], [32, '09:15', 1], [2, '07:00', 7], [1, '10:00', 4], [41, '10:30', 6]], 'holidays': [], 'now': [2, '04:44', 10, 18]}, 4), ({'events': [[1, '02:15', 7], [65, '20:30', 8], [65, '11:15', 3], [1, '01:45', 7]], 'holidays': [[4, 7, 1], [2, 14, 5]], 'now': [1, '11:15', 2, 14]}, 8), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[49, '17:30', 4], [62, '03:30', 3], [64, '22:00', 6], [2, '02:30', 2], [3, '12:30', 7]], 'holidays': [[3, 9, 5], [8, 11, 6]], 'now': [5, '12:30', 10, 27]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[126, '23:30', 5], [62, '16:30', 6], [64, '17:15', 9], [2, '20:45', 7]], 'holidays': [[9, 18, 5]], 'now': [2, '16:30', 9, 18]}, 6), ({'events': [[127, '02:45', 7], [64, '10:45', 2], [3, '04:00', 1], [1, '12:15', 7], [1, '16:30', 4]], 'holidays': [], 'now': [3, '10:45', 6, 13]}, 7)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %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 |
|---|---|---|---|
| timing oracle 0 | 2 | 2 | Passed |
| timing oracle 1 | 9 | 3 | Failed |
| timing oracle 2 | 2 | 2 | Passed |
| timing oracle 3 | 9 | 9 | Passed |
| timing oracle 4 | 9 | 9 | Passed |
| timing oracle 5 | 7 | 7 | Passed |
| timing oracle 6 | 1 | 8 | Failed |
| timing oracle 7 | 6 | 9 | Failed |
SHA-256 / 19861542b8917d0c836e12e4fc1ba2959eeac9d5d31be79656e3952ae27ffd9f
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def mins(s):
h, m = s.split(':')
return int(h) * 60 + int(m)
dow, hm, mo, dy = x['now']
t = mins(hm)
eff = dow
for hmo, hdy, as_dow in x['holidays']:
if hmo == mo and hdy == dy:
eff = as_dow
best = None
for mask, st, plan in x['events']:
if mask >> eff & 1 and mins(st) <= t:
if best is None or mins(st) >= best[0]:
best = (mins(st), plan)
if best is not None:
return best[1]
for back in range(1, 8):
d = (dow - back) % 7
cand = [(mins(st), plan) for mask, st, plan in x['events'] if mask >> d & 1]
if cand:
return cand[-1][1]
return 'free'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[127, '13:15', 6], [65, '07:15', 9], [32, '07:45', 8], [46, '13:45', 6], [64, '21:30', 7], [1, '22:30', 3]], 'holidays': [[11, 26, 1]], 'now': [1, '10:45', 11, 26]}, 3), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[64, '21:00', 2], [65, '22:45', 1], [2, '12:15', 9], [2, '02:45', 9], [1, '05:45', 3], [2, '10:15', 2]], 'holidays': [[11, 13, 4]], 'now': [3, '08:07', 9, 11]}, 9), ({'events': [[127, '16:30', 9]], 'holidays': [], 'now': [2, '16:30', 3, 26]}, 9), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[96, '20:30', 8], [96, '05:45', 1]], 'holidays': [[4, 6, 0]], 'now': [0, '06:30', 4, 6]}, 8), ({'events': [[25, '06:00', 7], [3, '10:00', 6], [127, '21:45', 9]], 'holidays': [], 'now': [2, '06:00', 3, 8]}, 9)], [({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[96, '17:00', 9], [1, '18:00', 6], [2, '04:00', 4], [65, '10:45', 7], [96, '16:15', 5], [1, '10:45', 9]], 'holidays': [[9, 20, 4]], 'now': [3, '10:45', 9, 20]}, 4), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[65, '21:15', 8], [65, '18:45', 4], [1, '13:30', 1], [45, '12:15', 5]], 'holidays': [], 'now': [1, '02:15', 8, 18]}, 8), ({'events': [[23, '04:45', 7], [62, '23:15', 3], [65, '21:30', 1], [6, '12:00', 9]], 'holidays': [[2, 22, 2]], 'now': [3, '04:45', 2, 22]}, 7), ({'events': [[127, '19:15', 8], [2, '15:45', 9]], 'holidays': [[1, 11, 0]], 'now': [4, '22:07', 1, 11]}, 8), ({'events': [[59, '12:15', 6], [3, '21:30', 2], [44, '04:15', 3], [92, '04:15', 2], [37, '22:00', 1], [1, '02:00', 6]], 'holidays': [[5, 14, 1]], 'now': [1, '04:15', 8, 10]}, 1)], [({'events': [[49, '19:45', 4], [1, '17:30', 1], [3, '09:00', 7], [122, '11:00', 3]], 'holidays': [[2, 20, 6], [12, 24, 6]], 'now': [2, '19:45', 11, 23]}, 3), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[3, '05:00', 3], [25, '04:30', 6], [62, '17:00', 6]], 'holidays': [[1, 5, 4]], 'now': [0, '11:30', 1, 5]}, 6), ({'events': [[64, '13:00', 3], [3, '02:00', 9], [109, '16:15', 3], [52, '07:15', 7]], 'holidays': [[5, 14, 4]], 'now': [3, '13:00', 5, 14]}, 7), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[3, '05:15', 9], [64, '16:45', 8]], 'holidays': [[1, 1, 2], [2, 6, 0]], 'now': [1, '18:07', 2, 6]}, 9), ({'events': [[64, '16:45', 7], [107, '11:30', 5], [126, '09:00', 1], [1, '05:00', 1]], 'holidays': [[3, 15, 5], [4, 4, 5]], 'now': [1, '01:44', 3, 15]}, 5)], [({'events': [[127, '07:30', 2], [64, '13:00', 2], [65, '21:15', 1]], 'holidays': [[10, 24, 2], [12, 19, 3]], 'now': [1, '21:44', 10, 3]}, 2), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[96, '10:30', 9], [32, '02:00', 6], [2, '15:45', 5], [62, '18:45', 4], [47, '23:45', 3], [15, '19:15', 6]], 'holidays': [[6, 20, 2]], 'now': [3, '00:30', 9, 17]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '19:30', 5], [96, '19:15', 6], [3, '22:00', 1], [127, '02:00', 6], [127, '11:30', 3]], 'holidays': [], 'now': [6, '12:45', 9, 8]}, 3), ({'events': [[2, '20:30', 8], [1, '15:15', 6], [64, '08:00', 6], [125, '04:45', 1], [96, '11:15', 3]], 'holidays': [], 'now': [4, '22:30', 10, 18]}, 1), ({'events': [[2, '04:15', 7], [17, '08:15', 1], [34, '05:30', 1]], 'holidays': [[12, 6, 2], [4, 19, 3]], 'now': [3, '04:15', 12, 6]}, 1)], [({'events': [[3, '17:00', 4], [127, '11:00', 7], [32, '09:15', 1], [2, '07:00', 7], [1, '10:00', 4], [41, '10:30', 6]], 'holidays': [], 'now': [2, '04:44', 10, 18]}, 4), ({'events': [[1, '02:15', 7], [65, '20:30', 8], [65, '11:15', 3], [1, '01:45', 7]], 'holidays': [[4, 7, 1], [2, 14, 5]], 'now': [1, '11:15', 2, 14]}, 8), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[49, '17:30', 4], [62, '03:30', 3], [64, '22:00', 6], [2, '02:30', 2], [3, '12:30', 7]], 'holidays': [[3, 9, 5], [8, 11, 6]], 'now': [5, '12:30', 10, 27]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[126, '23:30', 5], [62, '16:30', 6], [64, '17:15', 9], [2, '20:45', 7]], 'holidays': [[9, 18, 5]], 'now': [2, '16:30', 9, 18]}, 6), ({'events': [[127, '02:45', 7], [64, '10:45', 2], [3, '04:00', 1], [1, '12:15', 7], [1, '16:30', 4]], 'holidays': [], 'now': [3, '10:45', 6, 13]}, 7)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %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 |
|---|---|---|---|
| timing oracle 0 | 2 | 2 | Passed |
| timing oracle 1 | 3 | 3 | Passed |
| timing oracle 2 | 2 | 2 | Passed |
| timing oracle 3 | 2 | 9 | Failed |
| timing oracle 4 | 9 | 9 | Passed |
| timing oracle 5 | 7 | 7 | Passed |
| timing oracle 6 | 1 | 8 | Failed |
| timing oracle 7 | 9 | 9 | Passed |
SHA-256 / ddea57ee78d072d9b07d6f2313c7450a2d52b3267b42abf66646f71683ecac58
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
def mins(s):
h, m = s.split(':')
return int(h) * 60 + int(m)
dow, hm, mo, dy = x['now']
t = mins(hm)
eff = dow
for hmo, hdy, as_dow in x['holidays']:
if hmo == mo and hdy == dy:
eff = as_dow
best = None
for mask, st, plan in x['events']:
if mask >> eff & 1 and mins(st) <= t:
if best is None or mins(st) >= best[0]:
best = (mins(st), plan)
if best is not None:
return best[1]
for back in range(1, 8):
d = (dow - back) % 7
cand = [(mins(st), plan) for mask, st, plan in x['events'] if mask >> d & 1]
if cand:
return sorted(cand, key=lambda c: c[0])[-1][1]
return 'free'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[127, '13:15', 6], [65, '07:15', 9], [32, '07:45', 8], [46, '13:45', 6], [64, '21:30', 7], [1, '22:30', 3]], 'holidays': [[11, 26, 1]], 'now': [1, '10:45', 11, 26]}, 3), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[64, '21:00', 2], [65, '22:45', 1], [2, '12:15', 9], [2, '02:45', 9], [1, '05:45', 3], [2, '10:15', 2]], 'holidays': [[11, 13, 4]], 'now': [3, '08:07', 9, 11]}, 9), ({'events': [[127, '16:30', 9]], 'holidays': [], 'now': [2, '16:30', 3, 26]}, 9), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[96, '20:30', 8], [96, '05:45', 1]], 'holidays': [[4, 6, 0]], 'now': [0, '06:30', 4, 6]}, 8), ({'events': [[25, '06:00', 7], [3, '10:00', 6], [127, '21:45', 9]], 'holidays': [], 'now': [2, '06:00', 3, 8]}, 9)], [({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[96, '17:00', 9], [1, '18:00', 6], [2, '04:00', 4], [65, '10:45', 7], [96, '16:15', 5], [1, '10:45', 9]], 'holidays': [[9, 20, 4]], 'now': [3, '10:45', 9, 20]}, 4), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[65, '21:15', 8], [65, '18:45', 4], [1, '13:30', 1], [45, '12:15', 5]], 'holidays': [], 'now': [1, '02:15', 8, 18]}, 8), ({'events': [[23, '04:45', 7], [62, '23:15', 3], [65, '21:30', 1], [6, '12:00', 9]], 'holidays': [[2, 22, 2]], 'now': [3, '04:45', 2, 22]}, 7), ({'events': [[127, '19:15', 8], [2, '15:45', 9]], 'holidays': [[1, 11, 0]], 'now': [4, '22:07', 1, 11]}, 8), ({'events': [[59, '12:15', 6], [3, '21:30', 2], [44, '04:15', 3], [92, '04:15', 2], [37, '22:00', 1], [1, '02:00', 6]], 'holidays': [[5, 14, 1]], 'now': [1, '04:15', 8, 10]}, 1)], [({'events': [[49, '19:45', 4], [1, '17:30', 1], [3, '09:00', 7], [122, '11:00', 3]], 'holidays': [[2, 20, 6], [12, 24, 6]], 'now': [2, '19:45', 11, 23]}, 3), ({'events': [[62, '06:00', 2], [65, '06:00', 6]], 'holidays': [[12, 25, 0]], 'now': [3, '08:00', 6, 25]}, 2), ({'events': [[2, '06:00', 3], [2, '09:00', 4], [2, '15:30', 5]], 'holidays': [], 'now': [1, '15:30', 5, 5]}, 5), ({'events': [[3, '05:00', 3], [25, '04:30', 6], [62, '17:00', 6]], 'holidays': [[1, 5, 4]], 'now': [0, '11:30', 1, 5]}, 6), ({'events': [[64, '13:00', 3], [3, '02:00', 9], [109, '16:15', 3], [52, '07:15', 7]], 'holidays': [[5, 14, 4]], 'now': [3, '13:00', 5, 14]}, 7), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[3, '05:15', 9], [64, '16:45', 8]], 'holidays': [[1, 1, 2], [2, 6, 0]], 'now': [1, '18:07', 2, 6]}, 9), ({'events': [[64, '16:45', 7], [107, '11:30', 5], [126, '09:00', 1], [1, '05:00', 1]], 'holidays': [[3, 15, 5], [4, 4, 5]], 'now': [1, '01:44', 3, 15]}, 5)], [({'events': [[127, '07:30', 2], [64, '13:00', 2], [65, '21:15', 1]], 'holidays': [[10, 24, 2], [12, 19, 3]], 'now': [1, '21:44', 10, 3]}, 2), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[96, '10:30', 9], [32, '02:00', 6], [2, '15:45', 5], [62, '18:45', 4], [47, '23:45', 3], [15, '19:15', 6]], 'holidays': [[6, 20, 2]], 'now': [3, '00:30', 9, 17]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[8, '21:00', 7]], 'holidays': [], 'now': [3, '20:59', 1, 2]}, 7), ({'events': [[64, '19:30', 5], [96, '19:15', 6], [3, '22:00', 1], [127, '02:00', 6], [127, '11:30', 3]], 'holidays': [], 'now': [6, '12:45', 9, 8]}, 3), ({'events': [[2, '20:30', 8], [1, '15:15', 6], [64, '08:00', 6], [125, '04:45', 1], [96, '11:15', 3]], 'holidays': [], 'now': [4, '22:30', 10, 18]}, 1), ({'events': [[2, '04:15', 7], [17, '08:15', 1], [34, '05:30', 1]], 'holidays': [[12, 6, 2], [4, 19, 3]], 'now': [3, '04:15', 12, 6]}, 1)], [({'events': [[3, '17:00', 4], [127, '11:00', 7], [32, '09:15', 1], [2, '07:00', 7], [1, '10:00', 4], [41, '10:30', 6]], 'holidays': [], 'now': [2, '04:44', 10, 18]}, 4), ({'events': [[1, '02:15', 7], [65, '20:30', 8], [65, '11:15', 3], [1, '01:45', 7]], 'holidays': [[4, 7, 1], [2, 14, 5]], 'now': [1, '11:15', 2, 14]}, 8), ({'events': [[62, '22:00', 1], [65, '23:00', 9], [127, '05:00', 3]], 'holidays': [[1, 1, 0]], 'now': [1, '02:00', 1, 1]}, 9), ({'events': [[49, '17:30', 4], [62, '03:30', 3], [64, '22:00', 6], [2, '02:30', 2], [3, '12:30', 7]], 'holidays': [[3, 9, 5], [8, 11, 6]], 'now': [5, '12:30', 10, 27]}, 3), ({'events': [[127, '06:30', 2], [62, '06:00', 5]], 'holidays': [], 'now': [2, '06:45', 3, 3]}, 2), ({'events': [[62, '06:00', 2], [65, '08:00', 6]], 'holidays': [[7, 4, 0]], 'now': [4, '07:00', 7, 4]}, 2), ({'events': [[126, '23:30', 5], [62, '16:30', 6], [64, '17:15', 9], [2, '20:45', 7]], 'holidays': [[9, 18, 5]], 'now': [2, '16:30', 9, 18]}, 6), ({'events': [[127, '02:45', 7], [64, '10:45', 2], [3, '04:00', 1], [1, '12:15', 7], [1, '16:30', 4]], 'holidays': [], 'now': [3, '10:45', 6, 13]}, 7)]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing oracle' + ' %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 |
|---|---|---|---|
| timing oracle 0 | 2 | 2 | Passed |
| timing oracle 1 | 3 | 3 | Passed |
| timing oracle 2 | 2 | 2 | Passed |
| timing oracle 3 | 9 | 9 | Passed |
| timing oracle 4 | 9 | 9 | Passed |
| timing oracle 5 | 7 | 7 | Passed |
| timing oracle 6 | 8 | 8 | Passed |
| timing oracle 7 | 9 | 9 | Passed |
SHA-256 / 76b0206b0a68c9ffa7eef699cdf5d11fff33fe3d96c8e864156292266ae14c1c
Verification & scope
A deterministic, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:47:59.092624+00:00.
Case digest / 2c4bbf6d6c7825bed5e61e95e56259b6458da30540ac538a17c28cfec5fd2140