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 time |
Memory |
Grader output |
1 |
Runtime error |
91 ms |
34568 KB |
Memory limit exceeded |
2 |
Runtime error |
93 ms |
34436 KB |
Memory limit exceeded |
3 |
Runtime error |
89 ms |
34528 KB |
Memory limit exceeded |
4 |
Runtime error |
96 ms |
34600 KB |
Memory limit exceeded |
5 |
Runtime error |
115 ms |
34616 KB |
Memory limit exceeded |
6 |
Runtime error |
90 ms |
34524 KB |
Memory limit exceeded |
7 |
Runtime error |
94 ms |
34572 KB |
Memory limit exceeded |
8 |
Runtime error |
90 ms |
34556 KB |
Memory limit exceeded |
9 |
Runtime error |
116 ms |
33728 KB |
Memory limit exceeded |
10 |
Runtime error |
105 ms |
33628 KB |
Memory limit exceeded |
11 |
Incorrect |
111 ms |
32760 KB |
Unexpected end of file - int32 expected |
12 |
Runtime error |
157 ms |
35396 KB |
Memory limit exceeded |
13 |
Runtime error |
194 ms |
43388 KB |
Memory limit exceeded |
14 |
Runtime error |
285 ms |
57104 KB |
Memory limit exceeded |
15 |
Runtime error |
275 ms |
59276 KB |
Memory limit exceeded |
16 |
Runtime error |
359 ms |
64924 KB |
Memory limit exceeded |
17 |
Runtime error |
150 ms |
65540 KB |
Execution killed with signal 9 |
18 |
Runtime error |
147 ms |
65536 KB |
Execution killed with signal 9 |
19 |
Runtime error |
159 ms |
65540 KB |
Execution killed with signal 9 |
20 |
Runtime error |
147 ms |
65540 KB |
Execution killed with signal 9 |