n,d,m = map(int,input().split())
nums = [int(x) for x in input().split()]
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]:
time[c]+=1
ans = max(ans,time[c]-nums[i])
else:
time[c]=nums[i]
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)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
84 ms |
29476 KB |
Unexpected end of file - int32 expected |
2 |
Incorrect |
87 ms |
29536 KB |
Unexpected end of file - int32 expected |
3 |
Incorrect |
87 ms |
29472 KB |
Unexpected end of file - int32 expected |
4 |
Incorrect |
88 ms |
29516 KB |
Unexpected end of file - int32 expected |
5 |
Incorrect |
84 ms |
29480 KB |
Unexpected end of file - int32 expected |
6 |
Incorrect |
86 ms |
29492 KB |
Unexpected end of file - int32 expected |
7 |
Incorrect |
88 ms |
29396 KB |
Unexpected end of file - int32 expected |
8 |
Incorrect |
85 ms |
29584 KB |
Unexpected end of file - int32 expected |
9 |
Incorrect |
91 ms |
27064 KB |
Unexpected end of file - int32 expected |
10 |
Incorrect |
94 ms |
27120 KB |
Unexpected end of file - int32 expected |
11 |
Incorrect |
97 ms |
26708 KB |
Unexpected end of file - int32 expected |
12 |
Runtime error |
146 ms |
34912 KB |
Memory limit exceeded |
13 |
Runtime error |
179 ms |
43804 KB |
Memory limit exceeded |
14 |
Runtime error |
226 ms |
47376 KB |
Memory limit exceeded |
15 |
Runtime error |
250 ms |
59952 KB |
Memory limit exceeded |
16 |
Runtime error |
313 ms |
64936 KB |
Memory limit exceeded |
17 |
Runtime error |
146 ms |
65536 KB |
Execution killed with signal 9 |
18 |
Runtime error |
162 ms |
65540 KB |
Execution killed with signal 9 |
19 |
Runtime error |
142 ms |
65536 KB |
Execution killed with signal 9 |
20 |
Runtime error |
157 ms |
65536 KB |
Execution killed with signal 9 |