As reported: Optiver SWE 26/27 online assessment (2026), in C++20: problem "OA v2", a class with a constructor,
SetCoreLoadandTick, simulating core temperatures with passive and active cooling.
OverheatPreventionController(passiveCoolingCapacity, activeCoolingCapacityPerCore, coreIds) — all cores start at 20.0 °C, running, with load 0 W and status idle.
setCoreLoad(timestamp, coreId, loadWatts) — only records a pending load for the core; the last call before the next tick wins. For a core that is shut down, this is a restart attempt: it succeeds only if the core's temperature observed at the next tick is strictly below 50 °C (the core then runs with that load); otherwise it is discarded and the core stays shut down with load 0.
tick(timestamp) → list — processes, in this order:
- Advance temperatures from the previous tick to
timestampin one linear step (the first tick advances nothing). - Shut down every running core whose temperature is ≥ 80 °C: its load becomes 0.
- Apply pending loads and restart attempts.
- Decide active cooling for the coming interval.
It returns "coreId=status" for every core whose status differs from what the previous tick reported (initially idle), sorted by core id. Statuses: idle (running, no active cooling), cooling (running, active cooling engaged for the next interval), shutdown.
Thermal model. A core's temperature changes at 0.02 °C per second per watt of net heat: load − passive share − active cooling. It never drops below 20.0 °C.
- Passive cooling. Every core — shut-down cores included — demands
load + 2W of passive cooling. If the total demand fits within the effective passive capacity, every core gets its full demand; otherwise the capacity is split in proportion to the demands. - Active cooling. An engaged core gets exactly
activeCoolingCapacityPerCoreW on top. - Vibration penalty. While
kcores are engaged, the effective passive capacity is reduced bypenalty(k)percent:penalty(0) = 0, otherwisepenalty(k) = Σ_{i=1..k} 10 / Fib_iwithFib = 1, 2, 3, 5, 8, 13, …. During an interval, the penalty follows the cores engaged at the tick that started it. - Choosing the cores to engage (step 4). Engage as few cores as possible such that every running core above 60 °C is engaged, and every running core whose temperature would rise faster than 0.5 °C/s (with the new loads and the penalty of the engaged set) is engaged. Engaging cores raises the penalty, which can push other cores over 0.5 °C/s in turn.
Example
Init 545 60 coreA coreB coreC
SetCoreLoad 100 coreA 350
SetCoreLoad 100 coreB 200
SetCoreLoad 100 coreC 50
Tick 100 → [coreA=cooling, coreB=cooling]
Tick 250 → [coreA=shutdown, coreB=idle]
SetCoreLoad 1099 coreA 350
Tick 1100 → [coreA=cooling, coreB=cooling]
- Tick 100: demand
352 + 202 + 52 = 606 > 545. Without active cooling coreA would rise at ≈ 0.67 °C/s → engage it; the 10% penalty (capacity 490.5) pushes coreB to ≈ 0.73 °C/s → engage it too; with 15% (capacity 463.25) coreC rises ≈ 0.21 °C/s and stays idle. - Tick 250: over 150 s coreA heats to ≈ 82.75 °C → shut down. With coreA at 0 W the demand fits, so coreB no longer needs cooling → idle.
- Tick 1100: coreA (2 W demand, fully served) cooled at 0.04 °C/s to ≈ 48.75 °C < 50, so the restart succeeds and the tick-100 situation repeats.
Constraints: 1 ≤ number of cores < 2^10; fewer than 2^10 operations; timestamps strictly increase across ticks; loads in [0, 2^15) W and capacities have milliwatt precision; inputs keep clear of every exact threshold (80 °C, 50 °C, 60 °C, 0.5 °C/s).
Code runner format: Init <passive> <activePerCore> <coreId>…, then one call per line — SetCoreLoad <timestamp> <coreId> <watts> or Tick <timestamp>. The harness prints [coreId=status,…] for each tick. Implement the class OverheatPreventionController (in Go: NewOverheatPreventionController and exported method names).