Problem Description
There are
- ADD t p: Add a task with deadline t and profit p
- DEL t p: Delete the task with deadline t and profit p, if multiple exists, delete any one of those. The data gurantees at least one exists.
After every operation, output the maximum profit after
Input Specifications
The first line are two integers
Output Specifications
Sample Input
Copy
5 10
ADD 1 5811
ADD 3 5032
DEL 3 5032
ADD 3 5550
ADD 5 3486
DEL 1 5811
DEL 3 5550
ADD 4 5116
ADD 3 9563
ADD 5 94
Sample Output
Copy
5811
10843
5811
11361
14847
9036
3486
8602
18165
18259
Comments