A10410 | Lena and Queries
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
Lena is a programmer. She got a task to solve at work.
There is an empty set of pairs of integers and $n$ queries to process. Each query is one of three types:
1. Add a pair $(a,b)$ to the set.
2. Remove a pair added in the query number $i$ . All queries are numbered with integers from $1$ to $n$ .
3. For a given integer $q$ find the maximal value $x·q+y$ over all pairs $(x,y)$ from the set.
Help Lena to process the queries.
There is an empty set of pairs of integers and $n$ queries to process. Each query is one of three types:
1. Add a pair $(a,b)$ to the set.
2. Remove a pair added in the query number $i$ . All queries are numbered with integers from $1$ to $n$ .
3. For a given integer $q$ find the maximal value $x·q+y$ over all pairs $(x,y)$ from the set.
Help Lena to process the queries.
输入格式
The first line of input contains integer $n$ ( $1<=n<=3·10^{5}$ ) — the number of queries.
Each of the next $n$ lines starts with integer $t$ ( $1<=t<=3$ ) — the type of the query.
A pair of integers $a$ and $b$ ( $-10^{9}<=a,b<=10^{9}$ ) follows in the query of the first type.
An integer $i$ ( $1<=i<=n$ ) follows in the query of the second type. It is guaranteed that $i$ is less than the number of the query, the query number $i$ has the first type and the pair from the $i$ -th query is not already removed.
An integer $q$ ( $-10^{9}<=q<=10^{9}$ ) follows in the query of the third type.
Each of the next $n$ lines starts with integer $t$ ( $1<=t<=3$ ) — the type of the query.
A pair of integers $a$ and $b$ ( $-10^{9}<=a,b<=10^{9}$ ) follows in the query of the first type.
An integer $i$ ( $1<=i<=n$ ) follows in the query of the second type. It is guaranteed that $i$ is less than the number of the query, the query number $i$ has the first type and the pair from the $i$ -th query is not already removed.
An integer $q$ ( $-10^{9}<=q<=10^{9}$ ) follows in the query of the third type.
输出格式
For the queries of the third type print on a separate line the desired maximal value of $x·q+y$ .
If there are no pairs in the set print "EMPTY SET".
If there are no pairs in the set print "EMPTY SET".
输入输出样例
输入 #1
7 3 1 1 2 3 3 1 1 -1 100 3 1 2 4 3 1
输出 #1
EMPTY SET 5 99 5
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted