QOJ.ac

QOJ

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

#14293. TEST_133

統計

给定序列 $a_1,\dots,a_n$, $m$ 次操作:

修改操作:给出 $l,r,x$,将 $a_l,a_{l+1},\dots,a_r$ 的值增加 $x$;

查询操作:给出 $l,r,x$,问满足 $l\le i\le r,\;a_i < x$ 的 $i$ 对应的 $a_i$ 的历史最大值(即初值和每次修改操作后的值中最大的一个)的最大值。

输入格式

第一行两个整数 $n,m$;

接下来一行 $n$ 个整数 $a_1,a_2,\dots,a_n$;

接下来 $m$ 行每行四个整数 $o,l,r,x$,其中 $o=1$ 表示修改操作,$o=2$ 表示查询操作。

输出格式

对每个查询操作,输出一行,表示答案(特别地,如果不存在满足条件的 $i$,则输出 -inf)。

样例数据

样例 1 输入

5 10
-53 36 41 55 77
1 1 1 10
2 4 4 79
2 3 3 -28
1 1 5 -29
1 1 3 27
2 2 5 88
2 2 3 24
1 2 2 10
1 1 3 -9
1 2 5 -10

样例 1 输出

55
-inf
77
-inf

子任务

Idea:nzhtl1477,Solution:ccz181078,Code:ccz181078,Data:ccz181078

对于 $0\%$ 的数据,满足 $n,m\le 5000$。

对于另外 $1/3%$ 的数据,查询操作保证 $l=1,\;r=n$。

对于另外 $1/3$ 的数据,没有修改操作。

对于 $100\%$ 的数据,满足 $1\le n,m\le 5\times 10^5$,$|a_i|\le 10^9$(仅初始给定的序列保证这个限制),$1\le l\le r\le n$,$|x|\le 10^9$。

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.