欢迎光临散文网 会员登陆 & 注册

CF 299B - Ksusha the Squirrel

2023-08-21 12:16 作者:您是打尖儿还是住店呢  | 我要投稿

Ksusha the Squirrel is standing at the beginning of a straight road, divided into n sectors. The sectors are numbered 1 to n, from left to right. Initially, Ksusha stands in sector 1.


Ksusha wants to walk to the end of the road, that is, get to sector n. Unfortunately, there are some rocks on the road. We know that Ksusha hates rocks, so she doesn't want to stand in sectors that have rocks.


Ksusha the squirrel keeps fit. She can jump from sector i to any of the sectors i + 1, i + 2, ..., i + k.


Help Ksusha! Given the road description, say if she can reach the end of the road (note, she cannot stand on a rock)?


Input

The first line contains two integers n and k (2 ≤ n ≤ 3·105, 1 ≤ k ≤ 3·105). The next line contains n characters — the description of the road: the i-th character equals ".", if the i-th sector contains no rocks. Otherwise, it equals "#".


It is guaranteed that the first and the last characters equal ".".


Output

Print "YES" (without the quotes) if Ksusha can reach the end of the road, otherwise print "NO" (without the quotes).

------------------------------------------------

松鼠 Ksusha 站在一条笔直的道路的起点,这条路分为 n 个部分。 扇区从左到右编号为 1 到 n。 最初,Ksusha 位于第 1 区。


Ksusha想要走到路的尽头,即到达n区。 不幸的是,路上有一些石头。 我们知道克苏莎讨厌岩石,所以她不想站在有岩石的区域。


松鼠 Ksusha 保持健康。 她可以从扇区 i 跳转到任意扇区 i + 1、 i + 2、 ...、 i + k。


帮助克苏莎! 根据道路描述,假设她是否能到达路的尽头(注意,她不能站在岩石上)?


输入

第一行包含两个整数n和k(2 ≤ n ≤ 3·105, 1 ≤ k ≤ 3·105)。 下一行包含 n 个字符——道路的描述:如果第 i 个扇区不包含岩石,则第 i 个字符等于“.”。 否则,它等于“#”。


保证第一个和最后一个字符等于“.”。


输出

如果 Ksusha 可以到达路的尽头,则打印“YES”(不带引号),否则打印“NO”(不带引号)。

----------------------------------------

就是查询是否有连续k个石头即可;

下面是代码:


CF 299B - Ksusha the Squirrel的评论 (共 条)

分享到微博请遵守国家法律