P7492 [Chuanzhi Cup #3 Finals] Sequence
Background
disangan233 is counting numbers. He hopes you can help him record the counting sequence and perform some operations.
Description
You are given a sequence $a$ of length $n$. You need to perform $m$ operations on it. There are two types of operations:
1. Given two integers $l, r$, query the maximum subarray sum in the range from $l$ to $r$.
2. Given three integers $l, r, k$, bitwise OR every $a_i$ in the range from $l$ to $r$ with $k$.
For all testdata, $n, m \leq 10^5$, $-2^{30} \leq a_i, k < 2^{30}$, and $1 \leq l \leq r \leq n$.
Note: For negative numbers, the bitwise OR is computed using 32-bit two's complement.
Input Format
The input consists of $m + 2$ lines.
The first line contains two positive integers $n, m$.
The second line contains $n$ integers $a_1 \ldots a_n$.
The next $m$ lines each start with one positive integer $op$. If $op = 1$, then two integers $l, r$ follow, representing a query. Otherwise, three integers $l, r, k$ follow, representing an update.
Output Format
Output several lines. Each line contains one integer, which is the answer to a query.
Explanation/Hint
Translated by ChatGPT 5