Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <set>
- #include <map>
- #include <algorithm>
- #include <cmath>
- #include <string>
- using namespace std;
- typedef long long ll;
- typedef vector<ll> vll;
- typedef vector<vector<ll>> vvll;
- int main(){
- int T;
- cin >> T;
- while (T--){
- bool lose = false;
- int num_killable = 0;
- int weird_size = 0;
- int a, b;
- cin >> a >> b;
- string s;
- cin >> s;
- s += 'X';
- int len=0;
- for (char c : s){
- if (c=='.') len++;
- else{
- if (len>=b){
- if(len > 4*b+a-2) {lose = true;}
- else if(len >= b && len < a) lose = true;
- else if(len >= a && len < 2*b) num_killable++;
- else{
- num_killable++;
- if (weird_size != 0) lose = true;
- else weird_size = len;
- }
- }
- len = 0;
- }
- }
- if (lose){
- cout << "NO\n";
- continue;
- }
- if (weird_size!=0){
- bool even = false, odd = false;
- if (weird_size <= a+2*b-2) even = true;
- if (weird_size <= a + 3*b-2 && weird_size >= 2*a) odd = true;
- if (weird_size >= 3*a && weird_size <=a+4*b-2) even = true;
- if (even && odd){
- cout << "YES\n";
- continue;
- }
- if (!even && !odd) {
- cout << "NO\n";
- continue;
- }
- if (odd) num_killable++;
- }
- if (num_killable%2==0){
- cout << "NO\n";
- }
- else{
- cout << "YES\n";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement