# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
143579 | tnbs10 | Rasvjeta (COCI17_rasvjeta) | Cpython 3 | 29 ms | 3420 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
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)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |