Aggregate with an explicit lateness policy
Process arrivals in listed order. Use nonnegative integer event time and signed integer value. Before each unique event, compute watermark as maximum accepted event time minus lateness; reject an event as late when its time is strictly below that prior watermark. Equality is accepted. Accepted events join half-open windows via time // width * width. Identical IDs are ignored, conflicting ID payloads fail, and late IDs are returned for audit. This is a simple local max-seen estimator, not a distributed watermark implementation; timestamp plausibility checking is an extension.
Your task
- Complete the starter function using the contract above.
- Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
- Run tests to record your result, then compare with the explained reference solution.
Examples
Inputtimes 3,12,8,21,6; width 10; lateness 5
OutputLast event late; windows 0,10,20 populated
Inputmaximum 10, lateness 5, next time 5
OutputAccepted
Implement the function, then run the tests.
Ctrl / ⌘ + Enter to test · Shift + Tab leaves editor