from math import ceil
n = int(input())
m = int(input())
k = int(input())
a = [0 for i in range(n)]
for i in range(m):
x = int(input()) - 1
for j in range(max(0, x - k), min(n - 1, x + k) + 1):
a[j] = 1
i = 0
sol = 0
while i < n:
if not a[i]:
j = i + 1
while j < n and not a[j]:
j += 1
sol += ceil((j - i) / (k * 2 + 1))
i = j
else: i += 1
print(sol)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
3300 KB |
Output is correct |
2 |
Correct |
25 ms |
3300 KB |
Output is correct |
3 |
Correct |
26 ms |
3380 KB |
Output is correct |
4 |
Correct |
27 ms |
3300 KB |
Output is correct |
5 |
Correct |
27 ms |
3420 KB |
Output is correct |
6 |
Correct |
26 ms |
3300 KB |
Output is correct |
7 |
Correct |
26 ms |
3300 KB |
Output is correct |
8 |
Correct |
28 ms |
3380 KB |
Output is correct |
9 |
Correct |
29 ms |
3380 KB |
Output is correct |
10 |
Correct |
28 ms |
3300 KB |
Output is correct |