6905.Lines and Queries I

Time Limit: 1s Memory Limit: 512MB

Your task is to efficiently process the following types of queries:

Add a lineax+bFind the maximum point in any line at positionx

Input Format(From the terminal/stdin)

The first line has an integer $n$ : the number of queries.

The following $n$ lines describe the queries. The format of each line is either "1 $a$ $b$ " or "2 $x$ ".

You may assume that the first query is of type 1.

  • $1 \le n \le 2 \cdot 10^5$
  • $-10^9 \le a,b \le 10^9$
  • $0 \le x \le 10^5$

Output Format(To the terminal/stdout)

Print the answer for each query of type 2.

Sample Input

Copy
6
1 1 2
2 1
2 3
1 0 4
2 1
2 3
 \n
 · · \n
 · \n
 · \n
 · · \n
 · \n
 · \n

Sample Output

Copy
3
5
4
5
 \n
 \n
 \n
 \n
Source: CSES, Geometry, 3429

Submit

请先 登录

© 2025 FAQs