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 = [0 if i == "
cnt = 0
for si in range(a, max(c, d)):
    if si != 0:
        cnt = 0
    else:
        cnt += 1
        if cnt == 2:
            print("No")
            exit()
if c < d:
    print("Yes")
    exit()
idx = b - 1
cnt = 0
while idx < d:
    if s[idx-1] == s[idx] == s[idx+1] == 1:
        print("Yes")
        exit()
    else:
        idx += 1
print("No")

n, a, b, c, d = map(int, input().split())
s = [0 if i == "
if c < d:
    print("Yes")
    exit()
idx = b - 1
cnt = 0
while idx < d:
    if s[idx-1] == s[idx] == s[idx+1] == 1:
        print("Yes")
        exit()
    else:
        idx += 1
print("No")

n, a, b, c, d = map(int, input().split())
s = [0 if i == "
cnt = 0
for si in range(a, n):
    if si != 0:
        cnt = 0
    else:
        cnt += 1
        if cnt == 2:
            print("No")
            exit()
if c < d:
    print("Yes")
    exit()
idx = b - 1
cnt = 0
while idx < d:
    if s[idx-1] == s[idx] == s[idx+1] == 1:
        print("Yes")
        exit()
    else:
        idx += 1
print("No")

n, a, b, c, d = map(int, input().split())
s = [0 if i == "
if c < d:
    print("Yes")
    exit()
idx = b - 1
cnt = 0
while idx <= d + 1:
    if s[idx] == 0:
        cnt = 0
    else:
        cnt += 1
        if cnt == 3:
            print("Yes")
            exit()
    idx += 1
print("No")

n, a, b, c, d = map(int, input().split())
s = [0 if i == "
if c < d:
    print("Yes")
    exit()
idx = b - 1
cnt = 0
while idx < d:
    if s[idx] == 0:
        cnt = 0
    else:
        cnt += 1
        if cnt == 3:
            print("Yes")
            exit()
    idx += 1
print("No")

n, a, b, c, d = map(int, input().split())
s = [0 if i == "
if c < d:
    print("Yes")
    exit()
idx = b - 1
cnt = 0
while idx <= d:
    if s[idx] == 0:
        cnt = 0
    else:
        cnt += 1
        if cnt == 3:
            print("Yes")
            exit()
    idx += 1
print("No")

n, a, b, c, d = map(int, input().split())
s = [0 if i == "
cnt = 0
for si in range(a, max(c, d)):
    if si != 0:
        cnt = 0
    else:
        cnt += 1
        if cnt == 2:
            print("No")
            exit()
if c < d:
    print("Yes")
    exit()
idx = b - 1
cnt = 0
while idx < d:
    if s[idx] == s[idx+1] == s[idx+2] == 1:
        print("Yes")
        exit()
    else:
        idx += 1
print("No")

n, a, b, c, d = map(int, input().split())
s = input()
for i in range(a, max(c, d)):
    if s[i-1:i+1] == "##":
        print("No")
        exit()
if c < d:
    print("Yes")
    exit()
for i in range(b-1, d):
    if s[i-1:i+2] == "...":
        print("Yes")
        exit()
print("No")

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Runtime Error

Accepted