The problem. A bakery logged its queue 100 times, on different days. A judge guesses the queue at any time of day by copying the nearest logged visit. That makes it jumpy: one day 5 people happened to queue at 10:18, where 2 is usual, so the judge says 5 for 10:18. Averaging many judges should cancel odd days like that, but 25 judges who learned from the same 100 visits make 25 identical guesses, and their average is just as jumpy.Your job. Choose which visits each judge learns from. rows_for(judge, n_rows) returns a list of row numbers from 0 to 99 (one row is one logged visit, and a row may appear more than once).What the puzzle does with your list:1. It calls rows_for(j, 100) for each judge j = 0 … 24.2. Judge j learns only from the visits you listed for it: at any time of day it says the queue at the nearest of them.3. The crowd’s guess at each time is the average of the 25 judges’ guesses.4. It scores the crowd: how many people it is off from the usual queue, averaged over the day. You win when the crowd is off by less than one judge who saw all 100 visits (1.257 people).
The bakery’s 100 logged visits (dots) and its usual queue (dashed). One judge copies the nearest visit, so its line jumps with every odd day. 25 judges who all saw every visit draw that same line, so their average is no better. The goal is the calm line it ends on. Your rows_for() decides which visits each judge sees.
rows_for(judge, n_rows)| judge | which judge this is, 0 to 24 | e.g. 0 |
| n_rows | how many visits the bakery logged (rows 0 to n_rows - 1) | e.g. 100 |
| returns | the row numbers this judge learns from, as a list (a row may appear more than once) | |