New Queries
Tag(s):

## Easy-Medium

Problem
Editorial
Analytics

You have an array A consisting of N integers and is 1 based index. You have to perform q queries on the given array. Queries can be of 3 types.

$1\; i\; X$ : Update the array value at ith position to X i.e. set $A[i] = X$
$2\; L\; R$ : Among all the even numbers from position L to R find the largest even number
$3 \;L \;R$ : Among all the odd numbers from position L to R find the largest odd number

Constraints
$1 \le N \le 10^5$
$1 \le L \le R \le N$
$1 \le i \le N$
$0 \le X \le 10^{18}$
$1 \le Q \le 10^5$

Input
First line contains N and Q as input. Next line contains N space separated integers denoting $A[i]$ . Next Q lines contain Q queries of any of the three above types
Output
Print result of each query of type 2 and 3 in a new line

SAMPLE INPUT
5 5
1 2 3 4 5
2 1 5
2 1 3
3 1 4
3 2 2
3 1 5
SAMPLE OUTPUT
4
2
3
DNE
5
Time Limit: 2.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Kotlin, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Swift-4.1, Visual Basic

## CODE EDITOR

Initializing Code Editor...

## This Problem was Asked in

Challenge Name

CodeRing - III

OTHER PROBLEMS OF THIS CHALLENGE
• Algorithms > Graphs
• Math > Number Theory