#K34187. Seat Allocation for Participants
Seat Allocation for Participants
Seat Allocation for Participants
You are given a seating arrangement in a grid of dimensions \(R \times C\). Each cell in the grid is either available (represented by the character 'O') or reserved (represented by the character 'X'). You are also given an integer \(P\) representing the number of participants who need a seat.
Your task is to determine whether there are at least \(P\) available seats in the grid. In other words, count the number of cells with 'O' and compare it against \(P\). If the number of available seats is greater than or equal to \(P\), print YES
; otherwise, print NO
.
Input/Output via standard streams: Your program should read from standard input (stdin) and write the answer to standard output (stdout).
inputFormat
The input is given in the following format:
R C P row_1 row_2 ... row_R
Where:
- \(R\) is the number of rows.
- \(C\) is the number of columns.
- \(P\) is the number of participants.
- Each
row_i
is a string of length \(C\) consisting of characters 'O' (available) and 'X' (reserved).
outputFormat
Output a single line: YES
if the grid has at least \(P\) available seats, otherwise NO
.
3 3 4
OXX
OXO
OOO
YES