Problem:


Score : 400 points

Problem Statement

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.

Constraints

4 \leq N \leq 200\ 000

S is a string of length N consisting of . and #.

1 \leq A, B, C, D \leq N

Square A, B, C and D do not contain a rock.

A, B, C and D are all different.

A < B

A < C

B < D

Input

Input is given from Standard Input in the following format:

N A B C D
S

Output

Print Yes if the objective is achievable, and No if it is not.

Sample Input 1

7 1 3 6 7
.#..#..

Sample Output 1

Yes

The objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)

A#B.#..

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

.#..#AB

Sample Input 2

7 1 3 7 6
.#..#..

Sample Output 2

No

Sample Input 3

15 1 3 15 13
...#.#...#.#...

Sample Output 3

Yes



Sample input:
7 1 3 6 7
.#..#..


Sample output:
Yes

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0

if c == d:
    flag = 1
elif c < d:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
else:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
    jump = 0
    for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break
    if jump != 1:
        if c >= 2:
            if c < n:
                if s[c-2] == "#" or s[c] == "#":
                    flag = 1
            else:
                if s[c-2] == "#":
                    flag = 1
        else:
            if c < n:
                if s[c] == "#":
                    flag = 1
             
if flag == 1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0

if c <= d:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
else:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
    jump = 0
    for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break
    if jump != 1:
        if c >= 2:
            if c < n:
                if s[c-2] == "#" or s[c] == "#":
                    flag = 1
            else:
                if s[c-2] == "#":
                    flag = 1
        else:
            if c < n:
                if s[c] == "#":
                    flag = 1
             
if flag == 1:
    print("No")
else:
        print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0

if c <= d:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
else:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
    jump = 0
    if c >= 2:
        if c < n:
            if s[c-2] == "#" or s[c] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break
        else:
            if s[c-2] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break
    else:
        if c < n:
            if s[c] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break  
        else:
            for i in range(a-1,n-2):
                if s[i] == s[i+1] == s[i+2] ==".":
                    jump = 1
                    break

if c <= d:
    if flag == 1:
        print("No")
    else:
        print("Yes")
else:
    if flag == 1:
        print("No")
    elif jump == 1:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()

def detb():
  sb=s[b-1:d]
  nb=len(sb)
  for i in range(nb-1):
    if sb[i:i+2]=='##':
      return 0
  s_b=s[:d-1]+'#'+s[d:]
    
  sa=s_b[a-1:c]
  na=len(sa)
  for i in range(na-1):
    if sa[i:i+2]=='##':
      return 0
  return 1

def deta():
  s_a=s[:b-1]+'#'+s[b:]
  sa=s_a[a-1:c]
  na=len(sa)
  for i in range(na-1):
    if sa[i:i+2]=='##':
      return 0
  s_a=s_a[:c-1]+'#'+s[c:]
    
  sb=s_a[b-1:d]
  nb=len(sb)
  for i in range(nb-1):
    if sb[i:i+2]=='##':
      return 0
  return 1
if detb() + deta()>0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0

if c <= d:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
else:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
    jump = 0
    if c >= 2:
        if c < n:
            if s[c-2] == "#" or s[c] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break
        else:
            if s[c-2] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break
    else:
        if c < n:
            if s[c] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break  
        else:
            if s[c-2] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break

if c <= d:
    if flag == 1:
        print("No")
    else:
        print("Yes")
else:
    if flag == 1:
        print("No")
    elif jump == 1:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()

def detb():
  sb=s[b-1:d]
  nb=len(sb)
  for i in range(nb-1):
    if sb[i:i+2]=='##':
      return 0
  s_b=s[:d-1]+'#'+s[d:]
    
  sa=s_b[a-1:c]
  na=len(sa)
  for i in range(na-1):
    if sa[i:i+2]=='##':
      return 0
  return 1

def deta():
  sa=s[a-1:c]
  na=len(sa)
  for i in range(na-1):
    if sa[i:i+2]=='##':
      return 0
  s_a=s[:c-1]+'#'+s[c:]
    
  sb=s_a[b-1:d]
  nb=len(sb)
  for i in range(nb-1):
    if sb[i:i+2]=='##':
      return 0
  return 1
if detb() + deta()>0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()

def detb():
  sb=s[b-1:d]
  nb=len(sb)
  for i in range(nb-1):
    if sb[i:i+2]=='##':
      return 0
  s_b=s[:d-1]+'#'+s[d:]
    
  sa=s_b[a-1:c]
  na=len(sa)
  for i in range(na-1):
    if sa[i:i+2]=='##':
      return 0
    else:
      return 1

def deta():
  sa=s[a-1:c]
  na=len(sa)
  for i in range(na-1):
    if sa[i:i+2]=='##':
      return 0
  s_a=s[:c-1]+'#'+s[c:]
    
  sb=s_a[b-1:d]
  nb=len(sb)
  for i in range(nb-1):
    if sb[i:i+2]=='##':
      return 0
    else:
      return 1
if detb() + deta()>0:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0

if c <= d:
    if s[c-1] == "#" or s[d-1] == "#":
        flag = 1
    elif s[a-1] == "#" or s[b-1] == "#":
        flag = 1
    else:
        for i in range(n-1):
            if s[i] == s[i+1] == "#":
                flag = 1
                break
else:
    jump = 0
    if c >= 2:
        if c < n:
            if s[c-2] == "#" or s[c] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break
        else:
            if s[c-2] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break
    else:
        if c < n:
            if s[c] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break  
        else:
            if s[c-2] == "#":
                flag = 1
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        jump = 1
                        break

if c <= d:
    if flag == 1:
        print("No")
    else:
        print("Yes")
else:
    if flag == 1:
        print("No")
    elif jump == 1:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
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 = True
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] == '.':
            can_swap = True
            break
    
if step(A,C) and step(B,D) and pass_path == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, min(c, n-1)):
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            if b > c:
                print("Yes")
            else:
                print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0
if s[c-1] == "#" or s[d-1] == "#":
    flag = 1
elif s[a-1] == "#" or s[b-1] == "#":
    flag = 1
else:
    for i in range(n-1):
        if s[i] == s[i+1] == "#":
            flag = 1
            break
ans = 1
if flag == 1:
    print("No")
elif c > d:
    ans = 0
    if c >= 2:
        if c < n:
            if s[c-2] != "#" or s[c] != "#":
                pass
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        ans = 1
                        break
        elif c <= n:
            if s[c-2] != "#":
                pass
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        ans = 1
                        break
    else:
        if c < n:
            if s[c] != "#":
                pass
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        ans = 1
                        break  
        
if ans == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
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 = True
if C > D:
    for b in range(B-1,D):
        if S[b-1] == '.' and S[b+1] == '.':
            break
        elif S[b] == '#':
            path_pass = False
            continue
    
if step(A,C) and step(B,D) and pass_path == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, min(c, n-1)):
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-2, min(c, n-1)):
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
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 step(A,C) and step(B,D)
    
if step(A,C) and step(B,D) and pass_path(C,D) == True:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0
ans = 0
if s[c-1] == "#" or s[d-1] == "#":
    flag = 1
elif s[a-1] == "#" or s[b-1] == "#":
    flag = 1
elif c == d:
    flag == 1
else:
    for i in range(n-1):
        if s[i] == s[i+1] == "#":
            flag = 1
            break

if flag == 1:
    print("No")
else:
    if c > d:
        if c >= 2:
            if s[c-2] == "#":
                print("No")
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        ans = 1
                        break
        else:
            if s[c] == "#":
                print("No")      
            else:
                for i in range(a-1,n-2):
                    if s[i] == s[i+1] == s[i+2] ==".":
                        ans = 1
                        break    
    else:
        ans = 1

if ans == 1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
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')

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, min(c, n-2)):
            if (s[b-2] == ".") & (s[b] == "."):
                print("Yes")
                break
            if c < n:
                if (s[c-2] == ".") & (s[c] == "."):
                    print("Yes")
                    break
          
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int,input().split())
S = input()
M = max(C,D)
for _ in range(5000):
    for i in range(len(S) - 1):
        if S[i] == S[i+1] and S[i+1] == '#':
            if A <= i+1 and i <= max(D,max(B,C)) :
                print("No")
                quit()
            elif i < A:
                S = S[i+2:]
                A -= i + 2
                B -= i + 2
                C -= i + 2
                D -= i + 2
            else:
                S = S[:i]
            
for i in range(len(S) - 2):
    if S[i] == S[i+1] and S[i+1]== S[i+2]  and S[i+2] == '.':
        print("Yes")
        quit()
if C <= B:
    print("Yes")
elif  C < D:
    print("Yes")
elif D <= C:
    print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, min(c, n-2)):
            if (s[b-2] == ".") & (s[b] == "."):
                print("Yes")
                break
            
          
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, min(c, n-2)):
            if (s[b-2] == ".") & (s[b] == "."):
                print("Yes")
                break
          
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, min(c, n-2)):
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, min(c, n-2)):
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int,input().split())
S = input()
M = max(C,D)
S = S[A-1:M]

for i in range(len(S) - 1):
    if S[i] == S[i+1] and S[i+1] == '#':
        print("No")
        quit()
for i in range(len(S) - 2):
    if S[i] == S[i+1] and S[i+1]== S[i+2]  and S[i+2] == '.':
        print("Yes")
        quit()
if C <= B:
    print("Yes")
elif  C < D:
    print("Yes")
elif D <= C:
    print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0
if s[c-1] == "#" or s[d-1] == "#":
    flag = 1
elif s[a-1] == "#" or s[b-1] == "#":
    flag = 1
else:
    for i in range(n-1):
        if s[i] == s[i+1] == "#":
            flag = 1
            break

if flag == 1:
    print("No")
elif c > d:
    ans = 0
    for i in range(a-1,n-2):
        if s[i] == s[i+1] == s[i+2] ==".":
            ans = 1
            break
    if ans == 1:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int,input().split())
S = input()
M = max(C,D)
S = S[A-1:M]

for i in range(len(S) - 1):
    if S[i] == S[i+1] and S[i+1] == '#':
        print("NO")
        quit()
for i in range(len(S) - 2):
    if S[i] == S[i+1] and S[i+1]== S[i+2]  and S[i+2] == '.':
        print("YES")
        quit()
if C <= B:
    print("YES")
elif  C < D:
    print("YES")
elif D <= C:
    print("NO")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0
if s[c-1] == "#" or s[d-1] == "#":
    flag = 1
else:
    for i in range(n-1):
        if s[i] == s[i+1] == "#":
            flag = 1
            break

if flag == 1:
    print("No")
elif c > d:
    ans = 0
    for i in range(a-1,n-2):
        if s[i] == s[i+1] == s[i+2] ==".":
            ans = 1
            break
    if ans == 1:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b, min(c, n-2)):
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = list(map(int, input().split()))
s = input()

flag = 0
ans = 0
if s[c-1] == "#" or s[d-1] == "#":
    flag = 1
else:
    for i in range(n-1):
        if s[i] == s[i+1] == "#":
            flag = 1
            break

if flag == 1:
    print("No")
elif c > d:
    ans = 0
    for i in range(a-1,n-2):
        if s[i] == s[i+1] == s[i+2] ==".":
            ans = 1
            break
    if ans == 1:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

for i in range(len(S) - 1):
    if S[i] == S[i+1] and S[i+1] == '#':
        print("No")
        quit()
for i in range(len(S) - 2):
    if S[i] == S[i+1] and S[i+1]== S[i+2]  and S[i+2] == '.':
        print("Yes")
        quit()
if C <= B:
    print("Yes")
elif  C < D:
    print("Yes")
elif D <= C:
    print("No")

Submission status: Wrong Answer

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

for i in range(len(S) - 1):
    if S[i] == S[i+1] and S[i+1] == '#':
        print("NO")
        quit()
for i in range(len(S) - 2):
    if S[i] == S[i+1] and S[i+1]== S[i+2]  and S[i+2] == '.':
        print("YES")
        quit()
if C <= B:
    print("YES")
elif  C < D:
    print("YES")
elif D <= C:
    print("NO")

Submission status: Wrong Answer

Solution code:
N,A,B,Q,D = map(int,input().split())
S = input()
C = []
for i in range(len(S)):
    C.append(S[i])

if Q<D:
    error = 0
    for i in range(B,Q-1):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
else:
    error = 0
    for i in range(B,D-1):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
    flag = 0
    for i in range(B-1,D):
        if C[i-1]=="." and C[i+1]=="." and C[i]==".":
            flag = 1
    if flag==0:
        error = 1

if error==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,Q,D = map(int,input().split())
S = input()
C = []
for i in range(len(S)):
    C.append(S[i])

if Q<D:
    error = 0
    for i in range(B,Q):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
else:
    error = 0
    for i in range(B,D):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
    flag = 0
    for i in range(B-1,D):
        if C[i-1]=="." and C[i+1]=="." and C[i]==".":
            flag = 1
    if flag==0:
        error = 1

if error==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,Q,D = map(int,input().split())
S = input()
C = []
for i in range(len(S)):
    C.append(S[i])

if Q<D:
    error = 0
    for i in range(len(C)-1):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
else:
    error = 0
    for i in range(len(C)-2):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
    flag = 0
    for i in range(B-1,D):
        if C[i-1]=="." and C[i+1]=="." and C[i]==".":
            flag = 1
    if flag==0:
        error = 1

if error==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,Q,D = map(int,input().split())
S = input()
C = []
for i in range(len(S)):
    C.append(S[i])

if Q<D:
    error = 0
    for i in range(len(C)-1):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
else:
    error = 0
    for i in range(len(C)-2):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
    flag = 0
    for i in range(B,D-1):
        if C[i]=="." and C[i+1]=="." and C[i+2]==".":
            flag = 1
    if flag==0:
        error = 1

if error==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,Q,D = map(int,input().split())
S = input()
C = []
for i in range(len(S)):
    C.append(S[i])

if Q<D:
    error = 0
    for i in range(len(C)-1):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
else:
    error = 1
    for i in range(len(C)-2):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
        if C[i]=="." and C[i+1]=="." and C[i+2]==".":
            error = 0
            break

if error==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,Q,D = map(int,input().split())
S = input()
C = []
for i in range(len(S)):
    C.append(S[i])

if Q<D:
    error = 0
    for i in range(len(C)-1):
        if C[i]=="#" and C[i+1]=="#":
            error = 1
            break
else:
    error = 1
    for i in range(len(C)-2):
        if C[i]=="." and C[i+1]=="." and C[i+2]==".":
            error = 0
            break

if error==0:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = map(int, input().split())
s = str(input())

if ('##' in s[a-1:]) == True: # そもそも行けるか
    print("No")
else:
    if d < c: # aがbを追い抜く必要があるとき
        # 抜かせるかどうか
        oinuki= s[b-2:d+1]
        if ("..." in oinuki) == True: # 3個以上の連続があれば抜かせる
            print("Yes")
        else: # 抜かせないとき
            print("No")
    else: # 追い抜く必要なし
        print("Yes")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = map(int, input().split())
s = str(input())

if ('##' in s) == True: # そもそも行けるか
    print("No")
else:
    if d < c: # aがbを追い抜く必要があるとき
        # 抜かせるかどうか
        oinuki= s[b-2:d]
        if ("..." in oinuki) == True: # 3個以上の連続があれば抜かせる
            print("Yes")
        else: # 抜かせないとき
            print("No")                
    else: # 追い抜く必要なし
        print("Yes")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = map(int, input().split())
s = str(input())

if ('##' in s) == True: # そもそも行けるか
    print("No")
else:
    if d < c: # aがbを追い抜く必要があるとき
        # 抜かせるかどうか
        oinuki= s[b:d-1]
        if ("..." in oinuki) == True: # 3個以上の連続があれば抜かせる
            print("Yes")

        else: # 抜かせないとき
            t = s[:d-1] + "#" + s[d:]
            if ("##" in t) == True: # bがゴールに到達した後、行けるか
                print("No")
            else:
                print("Yes")
    else: # 追い抜く必要なし
        print("Yes")

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = [int(x) for x in input().rsplit()]
S = input()

sunuke_possible = "##" not in S[A - 1:C]
funuke_possible = "##" not in S[B - 1:D]

if C > D:
    passing = "..." in S[B - 1:D + 2]
    possible = sunuke_possible * funuke_possible * passing
else:
    possible = sunuke_possible * funuke_possible

print("Yes" if possible else "No")

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = [int(x) for x in input().rsplit()]
S = input()

sunuke_possible = "##" not in S[A - 1:C]
funuke_possible = "##" not in S[B - 1:D]

if C > D:
    passing = "..." in S[B - 1:D]
    possible = sunuke_possible * funuke_possible * passing
else:
    possible = sunuke_possible * funuke_possible

print("Yes" if possible else "No")