QOJ.ac

QOJ

実行時間制限: 6 s メモリ制限: 64 MB 満点: 100

#7449. regexes

統計

Given a sequence $a$ of length $n$, you need to perform $m$ operations:

1 l r x: Subtract $x$ from all elements in the range $[l, r]$ that are greater than $x$.

2 l r: Query the sum, minimum value, and maximum value of the range $[l, r]$.

Input

The first line contains two positive integers $n$ and $m$.

The second line contains $n$ positive integers representing the sequence $a$.

Each of the following $m$ lines contains $3$ or $4$ positive integers representing an operation.

This problem is forced online. All input values $l, r, x$ must be XORed with $lastans$, which is defined as the sum of the range from the most recent query operation modulo $2^{20}$. If no query operation has been performed yet, $lastans$ is $0$.

Output

For each operation of type 2, output three space-separated integers representing the answer.

Examples

Input 1

5 5
2 4 5 1 3
1 2 4 3
2 1 5
2 10 12
1 7 3 7
2 5 3

Output 1

9 1 3
6 1 3
4 1 2

Subtasks

Idea: wangziji & Huahua, Solution: wangziji & Huahua, Code: ccz181078, Data: wangziji & Huahua & ccz181078

Note: This problem uses bundled testing. You will only receive points for a subtask if you pass all test cases within that subtask.

For $1\%$ of the data, $n, m \leq 1000$, time limit is 3s.

For another $14\%$ of the data, $a_i \leq 10$, $n, m \leq 2 \times 10^5$, time limit is 3s.

For another $19\%$ of the data, $a_i \leq 1000$, $n, m \leq 2 \times 10^5$, time limit is 3s.

For another $19\%$ of the data, $a_i \leq 2 \times 10^5$, $n, m \leq 2 \times 10^5$, time limit is 3s.

For $100\%$ of the data, $1 \leq n, m \leq 5 \times 10^5$, $1 \leq a_i, x \leq 10^9$.

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#1377EditorialOpenEditorial for #7449pystraf2026-04-02 13:33:16View

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.