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 = list(str(x) for x in input())

start = min(a,b)
stop = max(c,d)
ans=0

if a<b and c<d:
    for i in range(start, stop):
        if s[i] == "#" and s[i+1] == "#":
            ans = "NO"
            break
    if ans == 0:
        ans = "YES"

elif b<a  and d<c:
    for i in range(start-1, stop):
        if s[i] == "#" and s[i+1] == "#":
            ans = "NO"
            break
    if ans == 0:
        ans = "YES"

elif a<b and d<c:
    judge = 0

    for i in range(start-1, stop):
        if b-1 <=i <= d-2:
            if s[i]=="." and s[i+1]=="." and s[i+2]==".":
                judge = 1
        if s[i] == "#" and s[i+1] == "#":
            ans = "NO"
            break

    if ans == 0:
        if s[b-2]=="." and s[b]==".":
            ans = "YES"
        elif judge == 1:
            ans = "YES"
        elif judge == 0:
            ans = "NO"

elif b<a and c<d:
    judge = 0

    for i in range(start, stop):
        if a-1 <=i <= c-2:
            if s[i]=="." and s[i+1]=="." and s[i+2]==".":
                judge = 1
        if s[i] == "#" and s[i+1] == "#":
            ans = "NO"
            break

    if ans == 0:
        if s[a-2]=="." and s[a]==".":
            ans = "YES"
        elif judge == 1:
            ans = "YES"
        elif judge == 0:
            ans = "NO"
print(ans)

n,a,b,c,d = map(int, input().split())
s = list(str(x) for x in input())

start = min(a,b)
stop = max(c,d)
ans=0

if a<b and c<d:
    for i in range(start, stop):
        if s[i] == "#" and s[i+1] == "#":
            ans = "No"
            break
    if ans == 0:
        ans = "Yes"

elif b<a  and d<c:
    for i in range(start-1, stop):
        if s[i] == "#" and s[i+1] == "#":
            ans = "No"
            break
    if ans == 0:
        ans = "Yes"

elif a<b and d<c:
    judge = 0

    for i in range(start-1, stop):
        if b-1 <=i <= d-2:
            if s[i]=="." and s[i+1]=="." and s[i+2]==".":
                judge = 1
        if s[i] == "#" and s[i+1] == "#":
            ans = "No"
            break

    if ans == 0:
        if s[b-2]=="." and s[b]==".":
            ans = "Yes"
        elif judge == 1:
            ans = "Yes"
        elif judge == 0:
            ans = "No"

elif b<a and c<d:
    judge = 0

    for i in range(start, stop):
        if a-1 <=i <= c-2:
            if s[i]=="." and s[i+1]=="." and s[i+2]==".":
                judge = 1
        if s[i] == "#" and s[i+1] == "#":
            ans = "No"
            break

    if ans == 0:
        if s[a-2]=="." and s[a]==".":
            ans = "Yes"
        elif judge == 1:
            ans = "Yes"
        elif judge == 0:
            ans = "No"
print(ans)

Verdicts: Wrong Answer

Accepted