ADD, DIV, MAX

아직 제출이 없습니다시간 제한5초메모리 제한256 MB

문제

You are given an integer sequence a_0,a_1,,a_N1a\_0, a\_1, \ldots, a\_{N-1}.

You have to perform QQ queries, each query is one of the following:

  • ADD t=0t=0, l r x: for each ii between ll and rr inclusively, a_i=a_i+xa\_i = a\_i + x.
  • DIV t=1t=1, l r x: for each ii between ll and rr inclusively a_i=floor(a_i/x)a\_i = {\rm floor}(a\_i / x), where floor(y){\rm floor}(y) is the biggest integer that is not greater than yy.
  • MAX t=2t=2. l r x=0: print max(a_l,a_l+1,,a_r){\rm max}(a\_l, a\_{l+1}, \ldots, a\_r).

입력

Input is given in the following format:

NN QQ

a_0a\_0 a_1a\_1 ... a_N1a\_{N-1}

t_1t\_1 l_1l\_1 r_1r\_1 x_1x\_1

t_2t\_2 l_2l\_2 r_2r\_2 x_2x\_2

\ldots

t_Qt\_Q l_Ql\_Q r_Qr\_Q x_Qx\_Q

출력

For each MAX query, print max(a_l,a_l+1,...,a_r){\rm max}(a\_l, a\_{l+1}, ..., a\_r).

제한

All input values are integers, 1N,Q200,0001 \leq N, Q \leq 200\\,000, 0a_i1080 \leq a\_i \leq 10^8, t_i=0,1,2t\_i = 0, 1, 2, 0l_ir_iN10 \leq l\_i \leq r\_i \leq N-1, 1x_i10001 \leq x\_i \leq 1000 if t_i2t\_i \neq 2, x_i=0x\_i=0 if t_i=2t\_i=2.

힌트

For Sample 1,

max(1,2,3,4,5)=5{\rm max}(1, 2, 3, 4, 5) = 5
1,2,3,4,511,12,3,4,51, 2, 3, 4, 5 \to 11, 12, 3, 4, 5
max(11,12,3,4,5)=12{\rm max}(11, 12, 3, 4, 5) = 12
max(3)=3{\rm max}(3) = 3
11,12,3,4,52,3,3,4,511, 12, 3, 4, 5 \to 2, 3, 3, 4, 5
max(2)=2{\rm max}(2) = 2
max(3)=3{\rm max}(3) = 3