JOI '13 - Watching

View as PDF

Submit solution

Points: 15 (partial)
Time limit: 1.0s
Memory limit: 64M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig
JOI Open Contest

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, \dots, 1\,000\,000\,000 from west to east. You want to watch N events. The i-th event will be held on the section A_i.

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.

Task

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.

Input Specification

Read the following data from the standard input.

  • The first line of input contains three space separated integers N, P, Q, where N is the number of the events, P is the number of small cameras, and Q is the number of large cameras.
  • The i-th line (1 \le i \le N) of the following N lines contains an integer A_i, the section where the i-th event will be held.

Output Specification

To the standard output, write the minimum value of w so that the pictures of all the sections of the events can be taken.

Constraints

All input data satisfy the following conditions.

  • 1 \le N \le 2\,000.
  • 1 \le P \le 100\,000.
  • 1 \le Q \le 100\,000.
  • 1 \le A_i \le 1\,000\,000\,000 (1 \le i \le N).

Subtasks

Subtask 1 [50 points]

N \le 100 is satisfied.

Subtask 2 [50 points]

There are no additional constraints.

Sample Input

3 1 1
2
11
17

Sample Output

4

Explanation for Sample Output

In this example, 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.


Comments


  • 4
    kassuno  commented on Aug. 18, 2018, 4:05 p.m.

    It's pretty weird that this is an AD Hoc problem because i can see only DP as a solution in this problem ?


    • 7
      Kirito  commented on Aug. 19, 2018, 12:08 p.m. edited

      Problem tag was updated. Thank you for pointing that out.