HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


50853 - Parking Place

Guest
• Review clarifications (1)

Volume problems

• 50446 - Snake
• 50875 - Take m-out
• 50786 - Top Question
• 50788 - Eight Puzzle
• 50509 - Reading Book
• 50529 - Row to Table
• 50499 - Table to Row
• 50823 - Secret Number
• 50853 - Parking Place
• 50496 - Falling Bricks
• 50802 - Comparing Exams
• 50785 - Swimming Contest
• 50866 - Buy the cheapest
• 50517 - Confusion Matrix
• 50515 - Lines - Revisited
• 50999 - Overlapping Trips
• 50507 - Sequential Numbers

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