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):
print("Yes")n,a,b,c,d = [int(i) for i in input().split()]
s = input()


flag1 = False
block = 0
for i in range(b, len(s)):
    if block == 2:
        flag1 = False
        break
    elif i == d-1:
        flag1 = True
        break
    elif s[i] == ".":
        block = 0
    elif s[i] == "#":
        block += 1

if flag1 == True:
    s2 = s[:d-1]+'#'+s[d:]
    flag1 = False
    block = 0
    for i in range(a, len(s)):
        if block == 2:
            flag1 = False
            break
        elif i == c-1:
            flag1 = True
            break
        elif s2[i] == ".":
            block = 0
        elif s2[i] == "#":
            block += 1


flag2 = False
flag3 = False
temp = 0
block = 0
for i in range(b-2,c-1):
    if temp == 3:
        flag2 = True
        temp = i-1
        break
    elif s[i] == "#":
        temp = 0
    elif s[i] == ".":
        temp += 1

if flag2 == True:
    flag3 = False
    block = 0
    s1 = s[:temp-1]+'#'+s[temp:]
    for i in range(a, len(s)):
        if block == 2:
            flag3 = False
            break
        elif i == c-1:
            flag3 = True
            break
        elif s1[i] == ".":
            block = 0
        elif s1[i] == "#":
            block += 1

    if flag3 == True:
        s3 = s1[:c - 1] + '#' + s1[c:]
        flag3 = False
        block = 0
        for i in range(temp + 1, len(s)):
            if block == 2:
                flag3 = False
                break
            elif i == c-1:
                flag3 = True
                break
            elif s3[i] == ".":
                block = 0
            elif s3[i] == "#":
                block += 1

if flag1 or flag3:
    print("Yes")
else:
    print("No")

print(Yes)

n,a,b,c,d = [int(i) for i in input().split()]
s = input()
flag1 = False
block = 0
for i in range(b, len(s)):
    if block == 2:
        flag1 = False
        break
    elif i == d-1:
        flag1 = True
        break
    elif s[i] == ".":
        block = 0
    elif s[i] == "#":
        block += 1
if flag1:
    s2 = s[:d-1]+'#'+s[d:]
    flag1 = False
    block = 0
    for i in range(a, len(s)):
        if block == 2:
            flag1 = False
            break
        elif i == c-1:
            flag1 = True
            break
        elif s2[i] == ".":
            block = 0
        elif s2[i] == "#":
            block += 1
flag2 = False
flag3 = False
temp = 0
block = 0
for i in range(b-2,c-2):
    if temp == 3:
        flag2 = True
        temp = i-1
        break
    elif s[i] == "#":
        temp = 0
    elif s[i] == ".":
        temp += 1
if flag2:
    flag3 = False
    block = 0
    s1 = s[:temp-1]+'#'+s[temp:]
    for i in range(a, len(s)):
        if block == 2:
            flag3 = False
            break
        elif i == c-1:
            flag3 = True
            break
        elif s1[i] == ".":
            block = 0
        elif s1[i] == "#":
            block += 1
    if flag3:
        s3 = s1[:c - 1] + '#' + s1[c:]
        flag3 = False
        block = 0
        for i in range(temp, len(s)):
            if block == 2:
                flag3 = False
                break
            elif i == d-1:
                flag3 = True
                break
            elif s3[i] == ".":
                block = 0
            elif s3[i] == "#":
                block += 1
if flag1 or flag3:
    print("Yes")
else:
    print("No")

Verdicts: Runtime Error

Runtime Error

Accepted