#abc244h. Ex - Linear Maximization
Ex - Linear Maximization
Score : points
问题描述
在二维平面上有一组点集合 。初始时, 为空。
按照顺序对每个 进行如下查询:
- 给定整数 , 和 。将点 添加到集合 中,然后计算 $\displaystyle \max_{(x,y) \in S}\left\{A_ix + B_iy\right\}$ 的值。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There is a set of points on a two-dimensional plane. is initially empty.
For each in this order, process the following query.
- You are given integers , and . Add point to , and then find $\displaystyle \max_{(x,y) \in S}\left\{A_ix + B_iy\right\}$.
Constraints
- All values in input are integers.
- If , then .
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer for the -th query.
Sample Input 1
4
1 0 -1 -1
0 1 2 0
-1 0 1 1
0 -1 1 -2
Sample Output 1
-1
2
1
2
- When : add point to , then it will become . For , we have , which is the maximum.
- When : add point to , then it will become . For , we have , which is the maximum.
- When : add point to , then it will become . For or , we have , which is the maximum.
- When : add point to , then it will become . For , we have , which is the maximum.
Sample Input 2
9
-1 4 -8 -2
9 -9 -7 7
4 1 6 7
-4 -1 -4 -5
-9 3 -2 -6
-1 0 -8 5
-8 -5 0 0
8 3 0 -4
2 -5 2 5
Sample Output 2
0
35
31
21
36
87
0
36
31
update @ 2024/3/10 10:30:49