HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Linear Data Structures: Arrays > problem:


50853 - Parking Place

Guest
• Review clarifications (1)

Section problems

• 50516 - Lines
• 50446 - Snake
• 50345 - Orders
• 50822 - Linked List
• 50529 - Row to Table
• 50499 - Table to Row
• 50990 - Two Neighbors
• 50823 - Secret Number
• 50853 - Parking Place
• 50496 - Falling Bricks
• 50876 - He is my cousin
• 50829 - Decode an Image
• 50851 - Repeated Numbers
• 50838 - Balanced Numbers
• 50515 - Lines - Revisited
• 50913 - Manhattan Distance
• 50824 - Sum of Group Maxes

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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.



Для отправки решений необходимо выполнить вход.

www.contester.ru