#C10477. Alice and Bob Element Comparison
Alice and Bob Element Comparison
Alice and Bob Element Comparison
Alice and Bob each have an array of n integers. You are given two arrays:
- \(A = (a_1, a_2, \ldots, a_n)\) for Alice
- \(B = (b_1, b_2, \ldots, b_n)\) for Bob
You will also be given q queries. Each query consists of two integers \(i\) and \(j\) (1-indexed). For each query, compare \(a_i\) with \(b_j\):
- If \(a_i < b_j\), print LESS
- If \(a_i = b_j\), print EQUAL
- If \(a_i > b_j\), print GREATER
Read the input from stdin and write the results to stdout. Each result should be output on its own line.
inputFormat
The input is given in the following format:
n a1 a2 ... an b1 b2 ... bn q i1 j1 ... iq jq
Where:
n
is the number of elements in each array.- The second line contains
n
space-separated integers representing Alice's array. - The third line contains
n
space-separated integers representing Bob's array. q
is the number of queries.- Each of the next
q
lines contains two integersi
andj
(1-indexed) representing a query.
outputFormat
For each query, output one line containing one of the following strings based on the comparison of ai
and bj
:
- LESS if
ai < bj
- EQUAL if
ai = bj
- GREATER if
ai > bj
5
3 1 5 4 2
4 5 1 3 2
3
1 2
3 3
5 5
LESS
GREATER
EQUAL
</p>