Problem Link : VACCHOS
There are N Hospitals and at each Hospital there are Pi number of Patients.You are a Doctor(But you are very Lazy) and You have been Given a task to Apply Vaccines to Each Patient.But There is a Problem.You can give Vaccine to Exactly K Patients on a Day.Your Task is to Find Smallest K (Because you are feeling Tired) such that you can Vaccinate all the Patients of N Hospitals in almost D days.
Note:-> If Patients of a Hospital is less than K then it is said to be Normal.
1)The first line of the input contains two space-separated integers denoting N and D respectively.
2)The second line contains N space separated integers denoting Patients P1,P2,….PN.
1)Print only one line containing a single integer denoting the smallest K as explained in the problem statement.
2)If it is not possible to find such K, then print −1
2 3 4 5 7 16
By Vaccinating 3 Patients for up to 16 Days He can Vaccinate all the Patients.
n,d=map(int,input().split()) a=list(map(int,input().split())) m = max(a) h = m l = 1 if d < n: print<<-1<<endl; else: v = False while l < h: k = (l+h)//2 s=0 for i in range(n): s += ceil(a[i]/k) if s == d: v = True print<<k<<endl; break if s < d: h = k else: l = k+1 if not v: print(l);