Under construction

Still being built. Things may change

Ggeureuda Gimgganom

Interview

Time limit1.5sMemory limit1024 MB

Summary
Given N rolls, cut K cm off each end (one end if shorter than 2K, discard if at most K), then find the largest piece length P so the trimmed rolls yield at least M pieces.
Level

Medium6 of 10

Topics
Binary search, Array, Math, Implementation
Solved
No attempts yet

Problem

Jeongrae runs a gimbap factory that makes gimbap to supply to the gimbap restaurant "Ggeureuda Gimgganom". Jeongrae calls the two ends of a gimbap roll its "tails", and a gimbap roll with its tails cut off a "trimmed gimbap".

The factory processes NN gimbap rolls: it cuts off the tails and turns the trimmed gimbap into gimbap pieces. When cutting off the tails, it cuts a uniform KK cm from both ends. If a roll is shorter than 2K2K cm, so that only one end can be cut, only one tail is cut off. If a roll is KK cm or shorter, it is discarded.

Every trimmed gimbap is then cut into pieces of a constant length PP, giving PP cm gimbap pieces. PP must be a positive integer. Jeongrae wants to make at least MM gimbap pieces cut to the constant length PP cm. Find the value PP should be set to when PP is to be as long as possible.

Input

The first line gives the number of gimbap rolls to trim, NN, the tail length KK, and the minimum number of gimbap pieces, MM. (1≤N≤1061 \le N \le 10^6, 1≤K,M≤1091 \le K, M \le 10^9, NN, KK, MM are integers)

Starting from the second line, the lengths LL of NN gimbap rolls are given. (1≤L≤1091 \le L \le 10^9, LL is an integer)

Output

Print PP, the maximum possible length of a gimbap piece. If no such PP exists, print -1.

Examples2

  1. Example 1

    Input
    3 6 4
    20
    10
    3
    
    Expected output
    2
    
  2. Example 2

    Input
    3 8 1
    16
    7
    8
    
    Expected output
    -1