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):
final = max(final,thing[i]-nums[i])
return final <= d
lo = 0
hi = m
while lo < hi:
mid = (lo+hi)//2
if check(mid):
hi = mid
else:
lo = mid+1
print(lo)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
92 ms |
35136 KB |
Memory limit exceeded |
2 |
Runtime error |
88 ms |
34884 KB |
Memory limit exceeded |
3 |
Runtime error |
113 ms |
34760 KB |
Memory limit exceeded |
4 |
Runtime error |
102 ms |
34752 KB |
Memory limit exceeded |
5 |
Runtime error |
92 ms |
34844 KB |
Memory limit exceeded |
6 |
Runtime error |
94 ms |
34828 KB |
Memory limit exceeded |
7 |
Runtime error |
93 ms |
34888 KB |
Memory limit exceeded |
8 |
Runtime error |
91 ms |
34776 KB |
Memory limit exceeded |
9 |
Runtime error |
108 ms |
33832 KB |
Memory limit exceeded |
10 |
Runtime error |
104 ms |
33916 KB |
Memory limit exceeded |
11 |
Runtime error |
114 ms |
32856 KB |
Memory limit exceeded |
12 |
Runtime error |
159 ms |
35964 KB |
Memory limit exceeded |
13 |
Runtime error |
203 ms |
43940 KB |
Memory limit exceeded |
14 |
Runtime error |
271 ms |
60732 KB |
Memory limit exceeded |
15 |
Runtime error |
299 ms |
59928 KB |
Memory limit exceeded |
16 |
Runtime error |
368 ms |
65460 KB |
Memory limit exceeded |
17 |
Runtime error |
145 ms |
65540 KB |
Execution killed with signal 9 |
18 |
Runtime error |
142 ms |
65540 KB |
Execution killed with signal 9 |
19 |
Runtime error |
142 ms |
65540 KB |
Execution killed with signal 9 |
20 |
Runtime error |
149 ms |
65536 KB |
Execution killed with signal 9 |