[BOJ 13978] Cameras

View as PDF

Submit solution

Points: 2
Time limit: 1.0s
Memory limit: 512M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

Your street has n houses, conveniently numbered from 1 to n. Out of these n houses, k of them have security cameras installed. Mindful of gaps in coverage, the Neighborhood Watch would like to ensure that every set of r consecutive houses has at least two different houses with cameras. What is the minimum number of additional cameras necessary to achieve this?

입력 형식

The first line of input contains three integers, n (2 ≤ n ≤ 100,000), k (0 ≤ k ≤ n), and r (2 ≤ r ≤ n).</p>

The next k lines of input contain the distinct locations of the existing cameras.

출력 형식

Print, on a single line, a single integer indicating the minimum number of cameras that need to be added.

예제 입력

15 5 4
2
5
7
10
13

예제 출력

3

Comments

There are no comments at the moment.