Canadian Computing Competition: 2025 Stage 1, Senior #5
Wow, your to-do list is empty... but not for long! Over the next few seconds, you'll have to handle
For the first type of update, you will have to add a new homework assignment to your to-do list. This assignment will be released at the beginning of second
After each update, you wonder: what's the earliest time you can finish all of the homework assignments in your to-do list? You can only work on one assignment at a time, and you must finish a homework assignment once you start it without switching to another assignment.
Input Specification
The first line of input contains an integer
The next A
or D
. A line starting with A
represents the first type of update and ends with two space-separated encrypted* integers
It is guaranteed that there is at least one homework assignment on your to-do list after every update.
The following table shows how the available
Marks | Bounds on |
Additional Constraints |
---|---|---|
2 | None | |
6 | Only updates of the first type | |
7 | None |
*Note that the input for this problem is encrypted. To decrypt and obtain the actual values of
Here,
Output Specification
Output
Sample Input 1
6
A 3 3
A 2 0
A 999996 999995
D 999991
A 1000000 999994
D 999992
Sample Input 1 (Unencrypted)
6
A 3 3
A 7 5
A 4 3
D 1
A 8 2
D 2
Output for Sample Input 1
5
11
13
11
13
9
Explanation of Output for Sample Input 1
The unencrypted sample input is provided for ease of reference.
After the first update, we can start the first assignment at the beginning of second
After the second update, we can do the first assignment over the interval
After the third update, we can do the first assignment over the interval
After the fourth update, we can do the third assignment over the interval
After the fifth update, we can do the third assignment over the interval
After the sixth update, we can do the third assignment over the interval
Sample Input 2
2
A 1000000 1000000
A 4 4
Sample Input 2 (Unencrypted)
2
A 1000000 1000000
A 1000000 1000000
Output for Sample Input 2
1999999
2999999
Comments
The problem statement/format is slightly confusing to me, because time is treated as a discrete rather than a continuous value. It just seems more natural to me to say that something that starts at time
and lasts for 
will end at time 
, rather than the "end of second 
". ¯\_(ツ)_/¯ It would have been worse if it weren't for the sample output and explanation.