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

#BS0000251. Koko ăn chuối (Koko Eating Bananas)

HỌC THEO LỘ TRÌNH

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

1 lộ trình

Koko ăn chuối (Koko Eating Bananas)

Koko Eating Bananas

Source: LeetCode

Version: Phuoc Hung OJ Extended

Problem Statement

Koko has nn banana piles with aia_i bananas in pile ii. The guards return in hh hours. She chooses a fixed positive integer rate xx. Each hour she eats up to xx bananas from one unfinished pile. If fewer than xx remain, she finishes that pile and waits until the next hour to start another. Find the minimum rate to finish all piles within hh hours.

Input

The first line contains n,hn,h: the number of piles and the time available in hours.

The second line contains exactly nn integers a1,a2,…,ana_1,a_2,\ldots,a_n, representing the banana counts.

Output

Print the minimum eating rate in bananas per hour.

Subtasks

  • Subtask 1 (20 points): 1≤n≤121\le n\le 12; 1≤ai≤501\le a_i\le 50 for every 1≤i≤n1\le i\le n; n≤h≤100n\le h\le 100.
  • Subtask 2 (30 points): 1≤n≤1041\le n\le 10^4; 1≤ai≤1091\le a_i\le 10^9 for every 1≤i≤n1\le i\le n; n≤h≤109n\le h\le 10^9; a1=a2=⋯=ana_1=a_2=\cdots=a_n.
  • Subtask 3 (50 points): 1≤n≤1041\le n\le 10^4; 1≤ai≤1091\le a_i\le 10^9 for every 1≤i≤n1\le i\le n; n≤h≤109n\le h\le 10^9.

Examples

Input

4 8
3 6 7 11

Output

4

Explanation

Rate 4 requires 1, 2, 2 and 3 hours, totaling 8. Rate 3 requires 1, 2, 3 and 4 hours, totaling 10. Lower rates cannot reduce the time, so 4 is minimal.