← November 2025 questions

NOVEMBER 2025 / INTERMEDIATE / QUESTION 2

Chef Borgort’s Burgers

Archived question

Try the question in your own editor, then check your output below.

THE QUESTION

Text from the official booklet. Refer to the PDF for original mathematical notation, formatting, and linked input files. Printed samples and inputs are reproduced as published.

Since arriving on Earth, the Borgor aliens have only eaten burgers. Chef Borgort
makes exactly one burger per hour and works for H hours a day. Shipments of
ingredients arrive each hour with specific calorie values, and each shipment lasts
exactly K hours before expiring.
At each hour, Chef Borgort can choose which available (non-expired) shipment to
use to maximize the total calories cooked in one day.
Input format:
First line: Three integers H, S, K
Next S lines: Two integers t, c— hour of arrival and calories
Constraints:
1 ≤ H ≤ 24, 1 ≤ S ≤ 1000, 1 ≤ K ≤ H
Output format:
One integer: maximum total calories
Sample Input:
5 8 1
1 300
1 500
2 400
2 100
3 200
3 350
4 600
5 250
Sample Output:
2100
Question Input:
10 20 3
1 400
1 300
2 500
2, 45
3 600
3 550
4 350
4 400
5 700
5 650
6 300
6 450
7 550
7 500
8 650
8 600
9 400
9 500
10 550
10 500

PRACTICE CHECK

Try your answer.

Practice convention: each shipment is consumed once. Read the printed “2, 45” as the pair (2,45).

Run your program in your own editor, then paste its output below. This checks the stated output or checkpoint; it does not assess your full program. Practice attempts do not affect competition scores.

Use the question input above. Enter only the output.

Reveal worked answer

Your output

5750

Assign shipments to eligible hours to maximise total calories. A shipment arriving at t is usable at t through t+K−1; each shipment can supply at most one burger.

Source: Girls in Code SEA 2025 Fall Competition, 29 November 2025. Booklet created by Emily Xu and the GIC question authors. Shared for non-commercial educational use with attribution, as permitted in the booklet.