PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#BS0000287. Chia kẹo cho trẻ em (Maximum Candies Allocated to K Children)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Chia kẹo cho trẻ em (Maximum Candies Allocated to K Children)

Maximum Candies Allocated to K Children

Source: LeetCode

Version: Phuoc Hung OJ Extended

Problem Statement

There are nn candy piles of sizes aia_i. Split piles as needed, but never combine candies from different original piles. Each of kk children receives one pile of equal size; leftovers may be unused. Find the greatest number of candies per child, or 00 if even one candy per child is impossible.

Input

First line: n,kn,k. Second line: nn integers aia_i.

Output

Print the maximum value, or 00.

Subtasks

  • Subtask 1 (20 points): 1≤n≤301\le n\le30; 1≤ai≤1001\le a_i\le100; 1≤k≤10001\le k\le1000.
  • Subtask 2 (30 points): 1≤n≤1051\le n\le10^5; 1≤ai≤1071\le a_i\le10^7; a1=⋯=ana_1=\cdots=a_n; 1≤k≤10121\le k\le10^{12}.
  • Subtask 3 (50 points): 1≤n≤1051\le n\le10^5; 1≤ai≤1071\le a_i\le10^7; 1≤k≤10121\le k\le10^{12}.

Examples

Input 1

3 3
5 8 6

Output 1

5

Explanation

Each pile yields one group of size 5; size 6 yields only two groups.

Input 2

2 11
2 5

Output 2

0

Explanation

The total is 7, so 11 positive groups are impossible.