Problem: There are N squares arranged in a row, numbered 1, 2, ..., N from left to right. You are given a string S of length N consisting of `.` and `#`. If the i-th character of S is `#`, Square i contains a rock; if the i-th character of S is `.`, Square i is empty.  In the beginning, Snuke stands on Square A, and Fnuke stands on Square B.  You can repeat the following operation any number of times:    * Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.  You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.  Determine whether this is possible.

Submission attempts (in order):
n, a, b, c, d = map(int, input().split())
s = input()
rock = 0
brank = 0
rfrag = 0
bfrag = 0
mrock = 0
mbrank = 0
rlist = []
blist = []
for i in range(n):
    if s[i] == "#":
        if bfrag == 1:
            if brank >= 3:
                blist.append(i-brank+1)
            if mbrank < brank:
                mbrank = brank
                brank = 0
            brank = 0
        rock += 1
        rfrag = 1
    if s[i] == ".":
        if rfrag == 1:
            if rock >= 2:
                rlist.append(i-rock+1)
            if mrock < rock:
                mrock = rock
                rock = 0
            rock = 0
        brank += 1
        bfrag = 1
if mrock < mbrank:
    if brank >= 3:
        blist.append(n-brank+1)
    if mbrank < brank:
        mbrank = brank
        brank = 0    
else:
    if mrock < rock:
        mrock = rock
        rock = 0

p = 0
for i in range(len(rlist)):
    if a < rlist[i] < c or b <  rlist[i] < d:
        print("No")
        p = 1
        break

y = 0 
if d < c and p == 0:
    x = 0
    for i in range(len(blist)):
        if b < blist[i] < d:
            x = 1            
    if x == 1:
        print("Yes")
        y = 1
    elif x == 0:
        print("No")
        y = 1
        
if p == 0 and y == 0:
    print("Yes")
print(blist, rlist)

n, a, b, c, d = map(int, input().split())
s = input()
rock = 0
brank = 0
rfrag = 0
bfrag = 0
mrock = 0
mbrank = 0
rlist = []
blist = []
for i in range(n):
    if s[i] == "#":
        if bfrag == 1:
            if brank >= 3:
                blist.append(i-brank+1)
            if mbrank < brank:
                mbrank = brank
                brank = 0
            brank = 0
        rock += 1
        rfrag = 1
    if s[i] == ".":
        if rfrag == 1:
            if rock >= 2:
                rlist.append(i-rock+1)
            if mrock < rock:
                mrock = rock
                rock = 0
            rock = 0
        brank += 1
        bfrag = 1
if mrock < mbrank:
    if brank >= 3:
        blist.append(n-brank+1)
    if mbrank < brank:
        mbrank = brank
        brank = 0    
else:
    if mrock < rock:
        mrock = rock
        rock = 0

p = 0
for i in range(len(rlist)):
    if a < rlist[i] < c or b <  rlist[i] < d:
        print("No")
        p = 1
        break

y = 0 
if d < c and p == 0:
    x = 0
    for i in range(len(blist)):
        if b-1 <= blist[i] < d:
            x = 1            
    if x == 1:
        print("Yes")
        y = 1
    elif x == 0:
        print("No")
        y = 1
        
if p == 0 and y == 0:
    print("Yes")

Verdicts: Wrong Answer

Accepted