题目描述
Problem Background
z小f loves mathematics.
Problem Description
Since z小f needs to prepare for NOIp and finds math homework too simple, he has handed the math homework to you.
The problem is as follows:
Given a quadratic function \( y = ax^2 + bx + c \) (where \( a \neq 0 \)), find the maximum (or minimum) value of the function.
z小f doesn't like to see such simple problems, so he decides to perform the following operations on the function:
Operation 1: Given a coefficient \( k \), shift the function up by \( k \) units (if \( k < 0 \), shift down by \(-k\) units).
Operation 2: Given a coefficient \( k \), shift the function right by \( k \) units (if \( k < 0 \), shift left by \(-k\) units).
Operation 3: Given coefficients \( k_1, k_2 \), perform a symmetry transformation of the function about the point \( (k_1, k_2) \).
Operation 4: Given coefficients \( k_1, k_2 \), find the minimum and maximum values of the function over the closed interval \([k_1, k_2]\).
Operation 5: Given coefficients \( u, v, w \), determine if the quadratic function \( y \) intersects with the quadratic function \( y_2 = ux^2 + vx + w \).
Since z小f requires it, you also need to output the final maximum (or minimum) value of the quadratic function \( y \).
Input Format
The first line contains a positive integer \( T \), representing the number of math homework problems (i.e., the number of data sets).
For each of the \( T \) data sets:
The first line contains three numbers \( a, b, c \), representing the coefficients of the quadratic function \( a, b, c \).
The second line contains a positive integer \( n \), representing the number of operations.
The next \( n \) lines, each containing an integer \( p \), representing the operation number, followed by the operation details (as described in the problem).
The data is guaranteed to be valid since z小f is so adorable.
Output Format
For each Operation 4, output two decimals, representing the minimum and maximum values of the interval (rounded to two decimal places).
For each Operation 5, output an integer, where 0 means no intersection and 2 means there is an intersection.
After each data set's operations are completed, output the final maximum (or minimum) value of the quadratic function \( y \) (rounded to two decimal places).
Sample Input and Output
Input Sample #1
1
1 0 0
4
1 3
1 -4
4 1 2
5 -1 0 -3
Output Sample #1
0.00 3.00
0
-1.00
Input Sample #2
1
-4 10 100
15
4 0 78
5 -4 -95 -97
1 -79
4 12 54
4 -60 11
1 83
4 68 80
2 -63
1 71
1 80
3 12 67
1 60
1 41
3 35 -13
4 6 26
Output Sample #2
-23456.00 106.25
2
-11103.00 -435.00
-14979.00 27.25
-24696.00 -17712.00
-6972.00 -1892.00
0.25
Notes
For 30% of the data, \( n <= 100 \), and there is no Operation 3.
For 60% of the data, \( n <= 1000 \).
For 100% of the data, \( T <= 10, n <= 10000 \).
The data guarantees \( a \neq 0, u \neq 0, a \neq u, 1 <= p <= 5, -100 <= a, b, c, k1, k2, k, u, v, w <= 100 \).
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分