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()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = False
if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
          pass_path = True
          break
        elif S[b] == '#':
          continue

ans = 'Yes' if step(A,C) and step(B,D)  and pass_path else 'No'
print(ans)

N,A,B,C,D = map(int,input().split())
S = input()

def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1

def pass_path(C,D):
    if C > D:
        for b in range(B-1,D):
            if S[b-1] == '.' and S[b+1] == '.':
              return True
            elif S[b] == '#':
              return False
    else:
        return False
    
if step(A,C) and step(B,D) and pass_path(C,D) == True:
    print('Yes')
else:
    print('No')

N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = False
if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
          pass_path = True
          break
        elif S[b] == '#':
          continue

if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = True

if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
            continue
        elif S[b] == '#':
            path_pass = False
            break

if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 

if C > D:
    pass_path = False
    for b in range(B-1,D):
        if S[b] == '#':
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break


if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')
if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = False
if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
             path_pass = True
            continue
        elif S[b] == '#':
            break

if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = False
if C > D:
    for b in range(B-1,D):
        if S[b] == '#':
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break


if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1
 
 
pass_path = False
if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break
        if S[b] == '#':
            continue

if step(A,C) and step(B,D)  and pass_path == True:
    print('Yes')
else:
    print('No')

N,A,B,C,D = map(int,input().split())
S = input()
 
def step(x,y):
    N_last = S[x:y-1]
    return N_last.find('##') == -1

Ans = step(A,C) and step(B,D)
 
if C > D:
    pass_path = False
    for b in range(B-1,D):
        if S[b] == '#':
            continue
        if S[b-1] == '.' and S[b+1] == '.':
            pass_path = True
            break
    Ans = step(A,C) and step(B,D) and  pass_path


if Ans == True:
    print('Yes')
else:
    print('No')

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Accepted