QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#9609. 幽默还是夢

統計

有 $n$ 个购买计划,第 $i$ 个计划形如:

  1. 花费 $a_i$ 的价钱购买一个物品;
  2. 花费 $b_i$ 的价钱购买两个物品。

两个选项不能同时选择,每个计划最多能执行一次。给定 $q$ 次操作:

  • 1 p x y:$a_p \leftarrow x, b_p \leftarrow y$
  • 2 l r k:只能执行 $i \in [l, r]$ 中的计划,希望购买 $k$ 个物品,花费的最少的价钱是多少

输入格式

一行两个整数 $n, q$

$n$ 行两个整数 $a_i, b_i$

$q$ 行操作,格式同上

输出格式

对每个询问操作输出一行一个整数

样例

见下发文件

数据范围

$1 \le n, q \le 1 \times 10^5, 1 \le a_i < b_i \le 10^9, 0 \le l \le r < n, 1 \le k \le 2(r - l + 1)$

子任务

子任务编号 特殊性质 分值
1 $1 \le n, q \le 14$ 5
2 $1 \le n, q \le 300$ 5
3 $1 \le n, q \le 2 \times 10^3$ 15
4 $1 \le n, q \le 1 \times 10^5, l = 0$,保证没有 $1$ 操作 15
5 保证没有 $1$ 操作 10
6 $1 \le n, q \le 8 \times 10^4$ 20
7 30
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.