#P2440. 木材加工

    ID: 3224 远端评测题 1000ms 128MiB 尝试: 2 已通过: 2 显示难度普及 上传者: 标签>贪心线性数据结构二分递归

木材加工

Background

Protect the environment.

Problem Description

A lumber mill has nn logs. We want to cut them into kk segments, each of length ll (there may be leftover wood).

Of course, we want the segments to be as long as possible. Please find the maximum value of ll.

The unit of length is cm\text{cm}. The lengths of the logs are positive integers, and we also require the lengths of the resulting segments to be positive integers.

For example, if there are two logs with lengths 1111 and 2121, and we need 66 equal segments, the longest possible segment length is 55.

Input Format

The first line contains two positive integers n,kn, k, denoting the number of logs and the required number of segments.

The next nn lines each contain a positive integer LiL_i, the length of one log.

Output Format

A single line containing the maximum value of ll.

If it is impossible to cut even segments of length 1cm\text{1cm}, output 0.

3 7
232
124
456
114

Hint

Constraints

For 100%100\% of the testdata, 1n1051 \le n \le 10^5, 1k1081 \le k \le 10^8, 1Li1081 \le L_i \le 10^8 (i[1,n]i \in [1, n]).

Translated by ChatGPT 5