Submission #446926

#TimeUsernameProblemLanguageResultExecution timeMemory
446926ntarsisJob Scheduling (CEOI12_jobs)Pypy 3
0 / 100
1099 ms65540 KiB
n,d,m = map(int,input().split()) nums = [int(x) for x in input().split()] for i in range(m): nums[i]=[nums[i],i+1] nums.sort() def check(x): time = [0]*x c = 0 ans = 0 for i in range(m): if c == x: c = 0 if time[c] >= nums[i][0]: time[c]+=1 ans = max(ans,time[c]-nums[i][0]) else: time[c]=nums[i][0] c+=1 return ans <= d lo = 1 hi = m while lo < hi: mid = (lo+hi)//2 if check(mid): hi = mid else: lo = mid+1 print(lo) final = [[] for i in range(10001)] last = [0]*lo c = 0 for i in range(m): if c == lo: c = 0 last[c] = max(last[c]+1,nums[i][0]) final[last[c]].append(nums[i][1]) c+=1 for i in range(1,n+1): print(*(final[i]+[0]))
#Verdict Execution timeMemoryGrader output
Fetching results...