Hide

Problem E
Happy Hibernation

Harold the bear is sick and tired of all this silly zombie business and ready for a long winter’s nap. However, a bit of planning is required: he wants to make sure he won’t get too hot while he sleeps! He needs your help to look at the weather forecast and pick an appropriate day to go to sleep, so that he will be able to get an uninterrupted sleep of a certain length during which the temperature will not get too hot.

Input

The first line of input consists of three space-separated integers: $1 \leq N \leq 100$, the number of days in the weather forecast; $1 \leq H \leq N$, the number of days Harold wants to sleep; and $-100 \leq T \leq 100$, the temperature above which it will be too hot for Harold to sleep.

The second line of input consists of $N$ space-separated integers, with each integer $t$ in the range $-100 \leq t \leq 100$. The $i$th integer records the forecasted temperature on day $i$. The days are indexed starting at $0$.

Output

Output the index of the earliest day on which Harold can go to sleep, that is, the earliest day which begins a consecutive sequence of at least $H$ days whose forecasted temperatures are all at most $T$. If there is no such consecutive sequence of $H$ days, you should output the string “Too hot!”.

Sample Input 1 Sample Output 1
10 4 35
40 32 36 34 33 31 34 34 41 45
3
Sample Input 2 Sample Output 2
10 6 35
40 32 36 34 33 31 34 34 41 45
Too hot!

Please log in to submit a solution to this problem

Log in