시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 | 128 MB | 158 | 99 | 63 | 62.376% |
There are many interesting cultures in Australia such as various sports and various kinds of animals. You are trying to watch many events held on a road in Brisbane.
The road is separated into 1 000 000 000 sections. The sections are numbered 1, 2, . . . , 1 000 000 000 from west to east. You want to watch N events. The i-th event will be held on the section Ai.
In order to watch the events, you prepared P small cameras and Q large cameras. You can choose a positive integer w as a parameter for taking pictures. Then, a small camera can take a picture of at most w consecutive sections, and a large camera can take a picture of at most 2w consecutive sections. Pictures of a section can be taken by more than one cameras. You want to take pictures of all the sections of the events. Since it is expected many people will visit the events, for the sake of safety, you have to fix the positions of the cameras and it is not allowed to move them during the events. The larger the parameter w is, the higher the cost to take pictures is. So, you want to minimize the value of w.
Write a program that, given information of the events and the number of cameras, determine the minimum value of w so that the pictures of all the sections of the events can be taken.
Read the following data from the standard input.
To the standard output, write the minimum value of w so that the pictures of all the sections of the events can be taken .
번호 | 배점 | 제한 |
---|---|---|
1 | 50 | N ≤ 100 is satisfied. |
2 | 50 | There are no additional constraints. |
3 1 1 2 11 17
4
13 3 2 33 66 99 10 83 68 19 83 93 53 15 66 75
9
In this example 1, when you choose w = 4, you can take pictures of all the sections of the events. For example, you can take pictures from the section 1 to 3 by a small camera, and you can take pictures from the section 11 to 18 by a large camera.