#K48677. Running Training Compliance
Running Training Compliance
Running Training Compliance
Daniel has a running training plan scheduled over m days. On some days, he runs a positive distance, and on others he takes a rest (represented by a distance of 0). However, he must never run more than 3 consecutive days without taking a rest day. Your task is to determine whether Daniel can complete his training plan without violating this rule.
Formally, let \( m \) be the total number of days and let \( d_1, d_2, \dots, d_m \) be the running distances on each day, where \( d_i > 0 \) indicates a running day and \( d_i = 0 \) a rest day. The plan is valid if there is no subsequence of more than 3 consecutive days with \( d_i > 0 \). Print Possible
if the plan respects this condition, or Not possible
otherwise.
inputFormat
The first line contains an integer \( m \) representing the number of days. The second line contains \( m \) space-separated integers representing the running distances for each day.
outputFormat
Output a single line: Possible
if Daniel can complete his training plan without violating the rule, or Not possible
otherwise.
6
5 5 5 0 10 15
Possible