SOLVE

LATER

Binary Queries

Problem

Editorial

Analytics

Some problems appear hard though they are very easy. Today Aakash is stuck in a range query problem. He has been given an array with only numbers 0 and 1. There are two types of queries -

**0 L R** : Check whether the number formed from the array elements L to R is even or odd and print **EVEN or ODD respectively**. Number formation is the binary number from the bits status in the array L to R

**1 X** : Flip the X^{th} bit in the array

**Indexing is 1 based**

**Input**

First line contains a number **N and Q** as input. Next line contains N space separated 0 or 1. Next Q lines contain description of each query

**Output**

Output for only query type 0 L R whether the number in range L to R is **"EVEN"** or **"ODD"** (without quotes).

**Constraints**

1≤ **N** ≤ 10^6

1≤ **L ≤ R** ≤ 10^6

1≤ **Q** ≤ 10^6

1≤ **X** ≤ **N**

Explanation

Our first query is 1 2 that means that we have to flip the 2nd bit in the given array so now our array becomes **1 1 1 1 0**

2^{nd} query is 0 1 4 which means that if i pick the subarray 1 to 4 i.e **1 1 1 1** then the number formed by decimal representation of this binary number is of what kind ?. Here the number formed is 15 so its odd and ODD is the output

Time Limit:
3.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,
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Swift,
Visual Basic,
Kotlin

Initializing Code Editor...

{"bf67448": "/pagelets/problem-author-tester/algorithm/range-query-2/", "bf673e5": "/pagelets/show-submission/algorithm/range-query-2/", "bf67471": "/pagelets/problems-hint/algorithm/range-query-2/", "bf6741b": "/pagelets/suggested-problems/algorithm/range-query-2/", "bf6749b": "/pagelets/recommended-problems/algorithm/range-query-2/"}

{}

realtime.hackerearth.com

80

352c30ab8a5741aaf88ccf58c2e235f8c3cee579

58a29e5cae2309f04b28

/realtime/pusher/auth/