Submission #446924

#TimeUsernameProblemLanguageResultExecution timeMemory
446924ntarsisJob Scheduling (CEOI12_jobs)Pypy 3
0 / 100
359 ms65540 KiB
n,d,m = map(int,input().split()) nums = [int(x) for x in input().split()] nums.sort() def check(x): thing = [0]*m count = 1 curr = 0 right = 0 while right < m: while right < min(m,curr+x): if nums[right]<=count: thing[right]=count right+=1 else: curr = right count+=1 count+=1 curr+=x final = 0 for i in range(m): if thing[i]-nums[i]>final: final = thing[i]-nums[i] return final <= d lo = 1 hi = 100000 while lo < hi: mid = (lo+hi)//2 if check(mid): hi = mid else: lo = mid+1 print(lo)
#Verdict Execution timeMemoryGrader output
Fetching results...