QOJ.ac

QOJ

حد الوقت: 30 s حد الذاكرة: 512 MB مجموع النقاط: 100

#14293. TEST_133

الإحصائيات

Given a sequence $a_1, \dots, a_n$, perform $m$ operations:

Update operation: Given $l, r, x$, increase the values of $a_l, a_{l+1}, \dots, a_r$ by $x$.

Query operation: Given $l, r, x$, find the maximum historical value (the maximum value among the initial value and all values after each update operation) of $a_i$ for all $i$ such that $l \le i \le r$ and $a_i < x$.

Input

The first line contains two integers $n, m$.

The next line contains $n$ integers $a_1, a_2, \dots, a_n$.

The next $m$ lines each contain four integers $o, l, r, x$, where $o=1$ denotes an update operation and $o=2$ denotes a query operation.

Output

For each query operation, output one line representing the answer (specifically, if no such $i$ exists, output -inf).

Examples

Input 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

Output 1

55
-inf
77
-inf

Subtasks

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

For $0\%$ of the data, $n, m \le 5000$.

For another $1/3$ of the data, query operations guarantee $l=1, r=n$.

For another $1/3$ of the data, there are no update operations.

For $100\%$ of the data, $1 \le n, m \le 5 \times 10^5$, $|a_i| \le 10^9$ (only the initial sequence is guaranteed to satisfy this limit), $1 \le l \le r \le n$, $|x| \le 10^9$.

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.