Created
June 14, 2022 06:38
-
-
Save mym0404/82a2bca6078451b360805762c63f5d9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
n, k, b = map(int, input().split()) | |
active = [1 for _ in range(n + 1)] | |
for i in range(b): | |
broken = int(input()) | |
active[broken] = 0 | |
active[0] = 0 | |
answer = 10 ** 9 | |
for i in range(1, n + 1): | |
active[i] += active[i - 1] | |
for i in range(k, n + 1): | |
current_active = active[i] - active[i - k] | |
answer = min(answer, k - current_active) | |
print(answer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment