CIW '26 P4 - Videostore
View as PDFCanadian Informatics Workshop 2026: Day 2, Problem 2
There will be customers coming to visit your video store. Customer
will arrive at the start of the
-th minute and leave at the end
of the
-th minute. You can also do
store tasks, labeled from
to
. To complete any task, you must have already completed each
task with a lower label. Each task takes
seconds to complete, must
be worked on in one continuous interval, and can be completed at most
once. You cannot serve customers when working on these tasks, and you
cannot work on these tasks when serving customers.
By serving customer during the entire duration of their visit, you
get
coins. Note that multiple customers may visit the store at any
time, and you can serve any number of customers simultaneously. By
completing task
, you get
coins.
You begin operating the store at the start of the st minute.
Maximize the number of coins you can get by the end of the
-th
minute.
Input Specification
The first line contains four integers ,
,
, and
(
).
Each of the next lines contains three integers
,
, and
(
).
The next line contains integers
(
).
The following table shows how the available 25 marks are distributed:
| Marks Awarded | Bounds on |
Bounds on |
Bounds on |
Additional Constraints |
|---|---|---|---|---|
| 2 marks | None | |||
| 3 marks | ||||
| 3 marks | No more than one customer will visit at any time | |||
| 4 marks | None | |||
| 4 marks | ||||
| 4 marks | No more than one customer will visit at any time | |||
| 5 marks | None |
Output Specification
Output a single integer representing the maximum number of coins you can
get by the end of the -th minute.
Sample Input
2 2 7 3
3 4 8
4 5 4
6 7
Sample Output
14
Explanation for Sample Output
There are several possible ways to earn coins, such as serving customers
and
from the start of the
rd minute to the end of the
th
minute for
coins or completing both tasks in
minutes for
coins. The maximum number of coins can be achieved by serving
customer
from the start of the
rd minute to the end of the
th minute and then completing task
from the start of the
-th
minute to the end of the
th minute for
coins.
Comments