题库练习 Game With String
← 上一题 下一题 →

A12941 | Game With String

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Alice and Bob play a game. Initially they have a string $s_1, s_2, \dots, s_n$ , consisting of only characters . and X. They take alternating turns, and Alice is moving first. During each turn, the player has to select a contiguous substring consisting only of characters . and replaces each of them with X. Alice must select a substing of length $a$ , and Bob must select a substring of length $b$ . It is guaranteed that $a > b$ .

For example, if $s =$ ...X.. and $a = 3$ , $b = 2$ , then after Alice's move string can turn only into XXXX... And if it's Bob's turn and the string $s =$ ...X.., then after Bob's move the string can turn into XX.X.., .XXX.. or ...XXX.

Whoever is unable to make a move, loses. You have to determine who wins if they both play optimally.

You have to answer $q$ independent queries.

输入格式

The first line contains one integer $q$ ( $1 \le q \le 3 \cdot 10^5$ ) — the number of queries.

The first line of each query contains two integers $a$ and $b$ ( $1 \le b < a \le 3 \cdot 10^5$ ).

The second line of each query contains the string $s$ ( $1 \le |s| \le 3 \cdot 10^5$ ), consisting of only characters . and X.

It is guaranteed that sum of all $|s|$ over all queries not exceed $3 \cdot 10^5$ .

输出格式

For each test case print YES if Alice can win and NO otherwise.

You may print every letter in any case you want (so, for example, the strings yEs, yes, Yes and YES will all be recognized as positive answer).

输入输出样例

输入 #1
3
3 2
XX......XX...X
4 2
X...X.X..X
5 3
.......X..X
输出 #1
YES
NO
YES
C++ 编辑器
输入
输出