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:
1.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++,
Clojure,
C#,
D,
Erlang,
F#,
Go,
Groovy,
Haskell,
Java,
Java 8,
JavaScript(Rhino),
JavaScript(Node.js),
Lisp,
Lisp (SBCL),
Lua,
Objective-C,
OCaml,
Octave,
Pascal,
Perl,
PHP,
Python,
Python 3,
R(RScript),
Racket,
Ruby,
Rust,
Scala,
Scala 2.11.8,
Swift,
Visual Basic

Initializing Code Editor...

{"35f4912": "/pagelets/problems-hint/algorithm/range-query-2/", "35f48bd": "/pagelets/show-submission/algorithm/range-query-2/", "35f48e6": "/pagelets/suggested-problems/algorithm/range-query-2/", "35f4927": "/pagelets/recommended-problems/algorithm/range-query-2/", "35f48fd": "/pagelets/problem-author-tester/algorithm/range-query-2/"}

{}

realtime.hackerearth.com

80

352c30ab8a5741aaf88ccf58c2e235f8c3cee579

58a29e5cae2309f04b28

/realtime/pusher/auth/