#P7781. Dynamic Convex Hull
Dynamic Convex Hull
Dynamic Convex Hull
Problem Description
Let's first see a related classical algorithm to help you solve this problem: You will be given functions , where . When you want to find the minimum value of for a fixed parameter , you just need to find the corresponding function on the convex hull. Now you will be given functions , where . You need to perform the following operations for times: · "" (): Add a new function and then change into . · "" (): Delete the function . It is guaranteed that each function won't be deleted more than once. · "" (): Query for the minimum value of , where and the function has not been deleted yet.
Input
The first line of the input contains a single integer (), the number of test cases. For each case, the first line of the input contains two integers and (), denoting the number of functions and the number of operations. Each of the following lines contains two integers and (), denoting the -th function . Each of the next lines describes an operation in formats described in the statement above.
Output
For each query, print a single line containing an integer, denoting the minimum value of . Note that when there is no functions, print "" instead.
Sample Input
1
2 8
3 9
6 100
3 4
2 1
3 4
1 1 1
3 4
2 2
2 3
3 4
Sample Output
10
116
82
-1
Source
2020 Multi-University Training Contest 2