Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб. Question by Ibrahim Mesecan.
Parking Place
You are writing a program for a parking place.
Park area is designed as line of parking places.
The director wants to respond fast for groups of cars.
When a group cars come, they want to park on a continuous
parking zone. The parking places are represented by
integers which represents the time remaining to be free.
(after this many minutes, the parking area will be free.)
Question:
You are given the information about a
parking place. Find the biggest parking area.
Input specification
You will be first given a number (n) the number
of parking places where 0 ≤ n ≤ 5000. Then, in
the following n lines, you will be given the time
remaining for parking places. In the last line,
you will be given the number of cars in the group and
the time after which the group comes.
Output specification:
Show "No", if it is not possible to give one
continues parking place for all cars. Otherwise,
show the size of the biggest parking area.
Sample Input I
10
0
24
28
45
55
75
1
16
20
22
3 30
|
Sample Output I
4
|
Explanation: There are 3 cars coming
after 30 minutes. Parking positions 1,2,3 and 7, 8, 9, 10
will be free after 30 minutes. So, the biggest continuous
parking area is 4.
Для отправки решений необходимо выполнить вход.
|