P5139 z Xiao f's Function
Background
z Xiao f loves mathematics.
Because z Xiao f needs to review for NOIp, and he thinks the math homework is too easy, he handed the math homework to you.
Description
Given a quadratic function $y=ax^{2}+bx+c(a\ne0)$, perform the following operations on the function:
- Operation 1: Given a coefficient $k$, shift the function upward by $k$ units (if $k
Input Format
The first line contains a positive integer $T$, indicating the number of math homework problems (i.e., the number of test cases).
Then follow $T$ test cases. For each test case:
> The first line contains three numbers $a,b,c$, representing the coefficients $a,b,c$ of the quadratic function.
>
> The second line contains a positive integer $n$, representing the number of operations.
>
> The next $n$ lines: each line starts with an integer $p$, indicating the operation number, and the following numbers are the parameters of the operation (see the Description).
The testdata is guaranteed to be valid.
Output Format
For each Operation 4, output two decimal numbers, representing the minimum and maximum values on the interval (keep two decimal places).
For each Operation 5, output one integer, where $0$ means there is no intersection point, and $2$ means there is an intersection point.
After completing all operations of each test case, output the maximum (or minimum) value of the final quadratic function $y$ at that time (keep two decimal places).
Explanation/Hint
For $30\%$ of the testdata, $n\le100$, and there is no Operation 3.
For $60\%$ of the testdata, $n\le1000$.
For $100\%$ of the testdata, $T\le10$, $n\le10000$.
The testdata guarantees $a\ne0,u\ne0,a\ne u,1\le p\le5,-100\le a,b,c,k1,k2,k,u,v,w\le100$.
Translated by ChatGPT 5