NOI Contest Archive

Archive / 2023 / Selection Test

Schoolyard Showdown

Medium · National Olympiad in Informatics Sri Lanka - Screening Test 2023

In a sprawling schoolyard, students of two different types, A and B, are scattered across a row of size \(n\). The schoolyard is represented as a string, where each character corresponds to a student’s type.

The types of students are denoted as follows:

You are given a series of queries to manipulate and analyze the student distribution in the schoolyard. There are two types of queries you need to implement:

  1. Toggle Query: Syntax: 1 x y

    This query allows you to toggle the type of each student within a given range [x, y] (inclusive). Specifically, all students in the range will switch their type from A to B or from B to A.

    Note that toggling means that if a student is initially of type A, it becomes type B, and vice versa.

  2. Count Query: Syntax: 2 x y

    This query requires you to determine if the number of students of type B within a given range [x, y] (inclusive), is odd or even. You need to output either “ODD” or “EVEN” accordingly.

    Note: Assume the string is 1-indexed

You need to implement a program that can process a sequence of these queries efficiently.

Input Format

Output Format

For each count query (type 2), output either “ODD” or “EVEN” on a new line.

Constraints

Subtask 1 - 20 pts

\[1 ≤ n ≤ 1000\] \[1 ≤ q ≤ 100\]

Subtask 2 - 30 pts

All queries are of type 2. (Count queries)

Subtask 3 - 50 pts

No other constraints

Sample Input 0

6
AAAAAA
4
1 1 3
1 2 4
2 1 3
2 1 4

Sample Output 0

ODD
EVEN