HBC24076怕npy的小宝[USACO 2017 Feb S]Why Did the Cow Cross the Road II题解

原来我爱你 算法基础篇 55 0
想要成为编程高手?那就来试试全网最全C++题库,让您在练习中快速成长。
The long road through Farmer John's farm hasNcrosswalks across it, conveniently numbered1…N. 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 leastKworking signals.

The long road through Farmer John's farm has N crosswalks across it, conveniently numbered 1…N (1≤N≤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 K working signals.

HBC24076怕npy的小宝[USACO 2017 Feb S]Why Did the Cow Cross the Road II题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC24076怕npy的小宝[USACO 2017 Feb S]Why Did the Cow Cross the Road II题解