#H. [USACO17FEB] Why Did the Cow Cross the Road II S

    远端评测题 1000ms 125MiB

[USACO17FEB] Why Did the Cow Cross the Road II S

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

题目描述

The long road through Farmer John's farm has NN crosswalks across it, conveniently numbered 1N1 \ldots N (1N100,0001 \leq N \leq 100,000). To allow cows to cross at these crosswalks, FJ installs electric crossing signals, which light up with a green cow icon when it is ok for the cow to cross, and red otherwise. Unfortunately, a large electrical storm has damaged some of his signals. Given a list of the damaged signals, please compute the minimum number of signals that FJ needs to repair in order for there to exist some contiguous block of at least KK working signals.

共有N个信号灯,编号为1~N,有B个信号灯损坏,给你它们的编号。

问,最少修好几个信号灯,可以有K个编号连续的信号灯。

输入格式

The first line of input contains NN, KK, and BB (1B,KN1 \leq B, K \leq N). The next BB lines each describe the ID number of a broken signal

输出格式

Please compute the minimum number of signals that need to be repaired in order for there to be a contiguous block of KK working signals somewhere along the road.

10 6 5
2
10
1
5
9
1

提示

感谢@ jlyzxxm1 提供题意简述

3.10上午8点半练习及作业

未认领
状态
已结束
题目
9
开始时间
2024-3-10 8:15
截止时间
2024-3-23 23:59
可延期
24 小时