#K67967. Meeting Schedule Validator

    ID: 32760 Type: Default 1000ms 256MiB

Meeting Schedule Validator

Meeting Schedule Validator

John's daily schedule is represented as an array of integers, where a 1 indicates a work-related task and a 0 indicates a break. For meetings to be scheduled properly, the schedule must obey two rules:

  • The number of consecutive work tasks must not exceed \( k \).
  • The number of consecutive breaks must not exceed \( m \).

Your task is to determine whether the given schedule satisfies these rules. If any of the rules is violated, the answer is NO; otherwise, the answer is YES.

inputFormat

The input consists of two lines:

  1. The first line contains three space-separated integers \( n \), \( k \), and \( m \), where \( n \) is the number of time slots in the schedule, \( k \) is the maximum allowed consecutive work tasks, and \( m \) is the maximum allowed consecutive breaks.
  2. The second line contains \( n \) space-separated integers (each either 0 or 1), representing John's schedule.

outputFormat

Output a single line containing YES if the schedule meets the conditions; otherwise, output NO.

## sample
8 3 2
1 1 1 0 1 0 0 1
YES