#C9172. Seat Checker
Seat Checker
Seat Checker
You are given a seating arrangement of a hall represented as a matrix of characters, where each element is either O
(indicating an available seat) or X
(indicating an occupied seat). You are also given a row index and a column index. Your task is to determine whether the seat at the given position is "Occupied" (if the character is X
) or "Available" (if the character is O
).
Note: The indices start from 0. In other words, the top-left seat is at position (0, 0).
The mathematical condition can be expressed as:
[ \text{status} = \begin{cases} \text{\texttt{Occupied}} & \text{if } S_{ij} = \texttt{X},\[6pt] \text{\texttt{Available}} & \text{if } S_{ij} = \texttt{O}, \end{cases} ]
where (S_{ij}) is the seat at row (i) and column (j).
inputFormat
The input is read from standard input (stdin) in the following format:
- The first line contains two integers r and c, the number of rows and columns in the seating arrangement.
- The next r lines each contain c characters separated by spaces, each being either
O
orX
. - The last line contains two integers, the row index and the column index of the seat to check.
outputFormat
Print a single word to standard output (stdout): either Occupied
or Available
, based on the seating status of the specified seat.
3 3
O X O
O O O
X X O
0 1
Occupied