#C9167. Seat Reservation
Seat Reservation
Seat Reservation
You are given a seating arrangement in the form of a grid with R rows and C columns. Each cell in the grid represents a seat where 0 indicates an available seat and 1 indicates an occupied seat. Your task is to determine if there is at least one row that contains at least K consecutive available seats.
Input Format: The first line contains three integers R, C, and K separated by spaces. The following R lines each contain C integers (0 or 1) separated by spaces representing the seating arrangement.
Output Format: Print Yes
if there exists a row with at least K
consecutive available seats. Otherwise, print No
.
Note: Your solution must read input from stdin
and write output to stdout
using the provided formats.
inputFormat
The input is read from stdin
as follows:
R C K row_1 row_2 ... row_R
Where each row_i
is a line of C
integers (each either 0 or 1) separated by spaces.
outputFormat
Output a single line to stdout
containing either Yes
or No
according to the conditions described.
4 5 3
0 1 0 0 0
0 0 1 0 0
1 0 0 0 1
0 1 1 1 0
Yes