#P6812. 「MCOI-02」Ancestor 先辈

「MCOI-02」Ancestor 先辈

Description

For two sequences a,ba,b, if the following holds:

imin(n,m),s.t. aibi\forall i \leq \min(n,m),s.t.\ a_i \leq b_i

then we say that aa is "worse" than bb (nn is the length of aa, and mm is the length of bb).

If for a sequence aa, it is "worse" than all of its suffixes, then we call this sequence an ancestor.

Given a sequence aia_i of length nn, there are kk operations, of the following two types:

  • 1 l r x Add xx to the interval [l,r][l,r].
  • 2 l r Query whether the interval [l,r][l,r] is an ancestor.

Input Format

The first line contains two integers n,kn,k, representing the sequence length and the number of operations.
The second line contains nn integers aia_i, representing the value of each element.
The next kk lines each start with three integers opt,l,ropt,l,r:

  • If opt=1opt=1, then an integer xx follows, representing operation 11.
  • If opt=2opt=2, it represents operation 22.

Due to a data failure, rr may be n+1n+1. In such cases, please set r=nr=n by yourself. Thank you.

Output Format

For each operation 22, output the query result.

7 5
1 9 1 9 8 1 0
2 1 3
1 3 4 9
2 1 4
1 5 6 11
2 2 6
No
Yes
No

Hint

Sample Explanation

For Sample 11:

  1. Query whether interval [1,3][1,3] is an ancestor. It is not, output No.
  2. Add 99 to interval [3,4][3,4]. Now the sequence is {1,9,10,18,8,1,0}\{1,9,10,18,8,1,0\}.
  3. Query whether interval [1,4][1,4] is an ancestor. It is, output Yes.
  4. Add 1111 to interval [5,6][5,6]. Now the sequence is {1,9,10,18,19,12,0}\{1,9,10,18,19,12,0\}.
  5. Query whether interval [2,6][2,6] is an ancestor. It is not, output No.

Constraints and Conventions

This problem uses bundled testdata.

  • Subtask 1 (1 pts)   \ \ : The interval length of every query operation is 11.
  • Subtask 2 (9 pts)   \ \ : n,k103n,k \le 10^3.
  • Subtask 3 (10 pts): n,k5×103n,k\le 5\times 10^3.
  • Subtask 4 (10 pts): Only query operations.
  • Subtask 5 (10 pts): The number of update operations does not exceed 100100.
  • Subtask 6 (20 pts): n,k105n,k \le 10^5.
  • Subtask 7 (40 pts): No special restrictions.

For 100%100\% of the testdata, 1n,k1061 \le n,k \le 10^6, ai,x109|a_i|,|x| \le 10^9.

This problem enforces O2O2 optimization.

Notes

Minecraft OI Round 2 C

  • Maker: happydef
  • Tester: tarjin

Translated by ChatGPT 5