Assignment Deadline

0

0 votes
Problem

You are given N assignments by your professor.

He also gives you a list of integers TIME. ith assignment takes TIME[i] hours to complete it. (1iN )

You have to complete all the assignment in less than or equal to K days. However you won't work on an assignment for more than T hours in a day.

On each day you can select any assignment and work on it for hours. If the choosen assignment requires less than T hours to complete, you still work on that assignment for hours.

Find minimum T (no. of hours you will work each day), so that you complete all the assignments in less than or equal to K days)

INPUT

  • First line contains (no. of assignments)
  • Second line contains N space seprated integers, ith integer denote the time required to complete the ith assignment ( 1iN)
  • Last input contains K, maximum number of days you can take to complete all assignment

OUTPUT

  • Print a single integer, T  (minimum no. of hours you will work each day to complete all the assignment in less than or equal to K days).

CONSTRAINTS

  • 1N106
  • 1TIME[i]1012
  • NK1018

Warning : Large I/O. Use fast I/O methods.

NOTE : A day is of 10^12 hours. 

Time Limit: 2
Memory Limit: 256
Source Limit:
Explanation

At T = 3 hours per day, you can complete the first assignment in 2 days, 2nd assignment in 2 days and third assignment in 1 day. Taking 5 days to complete all the three assignments.

Editor Image

?