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 = [int(x) for x in input().rsplit()]
S = input()

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

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")

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 + 1]
funuke_possible = "##" not in S[B - 1:D + 1]

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")

Submission status: Wrong Answer

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

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")

Submission status: Wrong Answer

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

if ("##" in S[A-1:C-1])|("##" in S[B-1:D-1]):
    print("No")
elif D > C:
    print("Yes")
elif "..." in S[B-1:D-1]:
    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:C-1])|("##" in S[B-1:D-1]):
    print("No")
elif D > C:
    print("Yes")
elif ".." in S[B-1:D-3]:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()
if a<b<c<d:
    if "##" not in s[a:d]:
        print("Yes")
    else:
        print("No")
elif a<c<b<d:
    if "##" not in s[a:c] and  "##" not in s[b:d]:
        print("Yes")
    else:
        print("No")
else:
    if "##" not in s[a:c] and "..." in s[b-1:d+2]:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()
if a<b<c<d:
    if "##" not in s[a:d]:
        print("Yes")
    else:
        print("No")
elif a<c<b<d:
    if "##" not in s[a:c] and  "##" not in s[b:d]:
        print("Yes")
    else:
        print("No")
else:
    if "##" not in s[a:c] and "..." in s[b:d+2]:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

def solve():
    is_comma_suc3 = '...' in S[B : D + 1]
    can_reach = not ('##' in S[A : C + 1] or '##' in S[B : D + 1])
    if C < D:
        return "Yes" if can_reach else "No"
    else:
        return "Yes" if is_comma_suc3 and can_reach else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

def solve():
    is_comma_suc3 = '...' in S[B-1 : D + 1]
    can_reach = not ('##' in S[A-1 : C + 1] or '##' in S[B-1 : D + 1])
    if C < D:
        return "Yes" if can_reach else "No"
    else:
        return "Yes" if is_comma_suc3 and can_reach else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

def solve():
    is_comma_suc3 = '...' in S[B : D]
    is_hash_suc_a2 = '##' in S[A : C]
    is_hash_suc_b2 = '##' in S[B : D]
    can_reach = not (is_hash_suc_a2 or is_hash_suc_b2)
    if C < D:
        return "Yes" if can_reach else "No"
    else:
        return "Yes" if is_comma_suc3 and can_reach else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()
#s=s[a:max(c,d)+1]
if ("##" in s[a:max(c,d)+1]) or (c>d and "..." not in s[b-1:d+2]):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

def solve():
    is_comma_suc3 = '...' in S[B-1 : D]
    is_hash_suc_a2 = '##' in S[A-1 : C]
    is_hash_suc_b2 = '##' in S[B-1 : D]
    is_hash_suc2 = is_hash_suc_a2 or is_hash_suc_b2
    if C < D:
        return "Yes" if not is_hash_suc2 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc2 else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()
#s=s[a:max(c,d)+1]
if ("##" in s) or (c>d and "..." not in s[b-1:d+2]):
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

# C < D ... #が３つ以上連続していなければYes
# C > D ... .が３つ以上連続し、#が３つ以上連続していなければYes
def solve():
    is_comma_suc3 = '...' in S[B - 1 : min(C,D)]
    is_hash_suc2 = '##' in S[A - 1 : max(C,D)]
    if C < D:
        return "Yes" if not is_hash_suc2 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc2 else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

# C < D ... #が３つ以上連続していなければYes
# C > D ... .が３つ以上連続し、#が３つ以上連続していなければYes
def solve():
    until = max(C,D)
    is_comma_suc3 = '...' in S[B - 1 : until]
    is_hash_suc3 = '##' in S[A - 1 : until]
    if C < D:
        return "Yes" if not is_hash_suc3 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc3 else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

# C < D ... #が３つ以上連続していなければYes
# C > D ... .が３つ以上連続し、#が３つ以上連続していなければYes
def solve():
    until = max(C,D)
    is_comma_suc3 = '...' in S[B : until]
    is_hash_suc3 = '###' in S[A - 1 : until]
    if C < D:
        return "Yes" if not is_hash_suc3 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc3 else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

# C < D ... #が３つ以上連続していなければYes
# C > D ... .が３つ以上連続し、#が３つ以上連続していなければYes
def solve():
    until = max(C,D)
    is_comma_suc3 = '...' in S[A - 1 : until]
    is_hash_suc3 = '###' in S[A - 1 : until]
    if C < D:
        return "Yes" if not is_hash_suc3 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc3 else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

# C < D ... #が３つ以上連続していなければYes
# C > D ... .が３つ以上連続し、#が３つ以上連続していなければYes
def solve():
    until = max(C,D)
    is_comma_suc3 = '...' in S[:until]
    is_hash_suc3 = '###' in S[:until]
    if C < D:
        return "Yes" if not is_hash_suc3 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc3 else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

# C < D ... #が３つ以上連続していなければYes
# C > D ... .が３つ以上連続し、#が３つ以上連続していなければYes
def solve():
    is_comma_suc3 = '...' in S
    is_hash_suc3 = '###' in S
    if C < D:
        return "Yes" if not is_hash_suc3 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc3 else "No"

if __name__ == "__main__":
    print(solve())

Submission status: Wrong Answer

Solution code:
import re

S = input()
S =re.sub("BC","D",S)

cnt = 0

if S.count("AD")==0:
  print(cnt)
else:
  while True:
    fd = S.count("AD")
    if fd == 0:
      break
    cnt += fd
    S = re.sub("AD", "DA", S)
  print(cnt)

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = " "+input()
def isAble():
    if "##" in S[A:C] or "##" in S[B:D]:
        return "No"
    if C>D:
        if "..." not in S[B-1:D+1]:
            return "No"
    return "Yes"

print(isAble())

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = input()
def isAble():
    if "##" in S[A:C] or "##" in S[B:D]:
        return "No"
    if C>D:
        if "..." not in S[B-1:D+1]:
            return "No"
    return "Yes"

print(isAble())

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = input()
def isAble():
    if "##" in S[A:max(C,D)]:
        return "No"
    if C>D:
        if "..." not in S[B-1:D+1]:
            return "No"
    return "Yes"

print(isAble())

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = input()
def isAble():
    if "##" in S[:max(C,D)]:
        return "No"
    if C==D:
        return "No"
    if C>D:
        if "..." not in S[:D+1]:
            return "No"
    return "Yes"

print(isAble())

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = input()
def isAble():
    if "##" in S:
        return "No"
    if C==D:
        return "No"
    if C>D:
        if "..." not in S[:D+1]:
            return "No"
    return "Yes"

print(isAble())

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = input()
def isAble():
    if "##" in S:
        return "No"
    if C>D:
        if "..." not in S:
            return "No"
    return "Yes"

print(isAble())

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = list(map(lambda x: int(x),input().split()))
S = input()
def isAble():
    if "##" in S:
        return "No"
    if C>D:
        if "..." not in S:
            return "No"
    return "Yes"

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = [int(i) for i in input().split()]
road = [i for i in list(input())]

for i in range(D-A):
  if (road[A+i-1] == '#') & (road[A+i] == '#'):
    judge = 0
    break
  else:
    judge = 1
if judge == 1:
  if C < D:
    judge = 1
  else:
    for i in range(D-B+1):
      print(B+i)
      if (road[B+i-2] == '.') & (road[B+i-1] == '.') & (road[B+i] == '.'):
        judge = 1
        break
      else:
        judge = 0

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

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = [int(i) for i in input().split()]
road = [i for i in list(input())]

for i in range(len(road)-1):
  if (road[i] == '#') & (road[i+1] == '#'):
    judge = 0
    break
  else:
    judge = 1
if judge == 1:
  if C < D:
    judge = 1
  else:
    for i in range(D-B+1):
      if (road[B+i-2] == '.') & (road[B+i-1] == '.') & (road[B+i] == '.'):
        judge = 1
        break
      else:
        judge = 0

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

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
Michi = list(input())
dpA = [0 for _ in range(C-A+2)]
dpA[1] = 1
dpB = [0 for _ in range(D-B+2)]
dpB[1] = 1
for i in range(2, len(dpA)):
    if Michi[i-2+A] == '#':
        continue
    if dpA[i-1] == 1 or dpA[i-2] == 1:
        dpA[i] = 1
for i in range(2, len(dpB)):
    if Michi[i-2+B] == '#':
        continue
    if dpB[i-1] == 1 or dpB[i-2] == 1:
        dpB[i] = 1
if C < D:
    print('Yes')
    exit()
else:
    cnt = 0
    for i in range(len(dpB)):
        if cnt > 2:
            print('Yes')
            exit()
        if dpB[i] == 1 and dpA[i+B-A] == 1:
            cnt += 1
            continue
        else:
            cnt = 0
print('No')

Submission status: Wrong Answer

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

if C < D:
    possible = "##" not in S
else:
    possible = "##" not in S and "..." in B_D

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()
B_D = S[B - 1:D]

if "##" in S:
    result = "No"
elif C < D:
    result = "Yes"
elif "..." in B_D:
    result = "Yes"
else:
    result = "No"

print(result)

Submission status: Wrong Answer

Solution code:
import re

count = 0

def count_inversion(sequence):
    return sum(sum(m>n for m in sequence[i+1:]) for i,n in enumerate(sequence))

s = input()
s = s.replace("BC", "D")
s = re.split(r"[B-C]+", s)

while "" in s:
    s.remove("")
for x in s:
    count += count_inversion(list(x))
        
print(count)

Submission status: Wrong Answer

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

for x in S[A:max(C, D)-1].split("."):
    if len(x) > 1:
        print("No")
        sys.exit()
    else:
        pass

if C < D:
    print("Yes")
    sys.exit()

for x in S[B-1:D+1].split("#"):
    if len(x) > 2:
        print("Yes")
        sys.exit()
    else:
        pass

print("No")

Submission status: Wrong Answer

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

for x in S[A:max(C, D)-1].split("."):
    if len(x) > 1:
        print("No")
        sys.exit()
    else:
        pass

if C < D:
    print("Yes")
    sys.exit()

for x in S[B-1:D-1].split("#"):
    if len(x) > 2:
        print("Yes")
        sys.exit()
    else:
        pass

print("No")

Submission status: Wrong Answer

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

for x in S[A:max(C, D)-1].split("."):
    if len(x) > 1:
        print("No")
        sys.exit()
    else:
        pass

if C < D:
    print("Yes")
    sys.exit()

for x in S[B-1:D].split("#"):
    if len(x) > 2:
        print("Yes")
        sys.exit()
    else:
        pass

print("No")

Submission status: Wrong Answer

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

for x in S[A:max(C, D)-1].split("."):
    if len(x) > 1:
        print("No")
        sys.exit()
    else:
        pass

if C < D:
    print("Yes")
    sys.exit()

for x in S[B:D-1].split("#"):
    if len(x) > 2:
        print("Yes")
        sys.exit()
    else:
        pass

print("No")

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map( int, input().split())
b = [ string for string in input()]

Z = True

for i in range ( A, C-3):
  if (b[i] is "#") and (b[i+1] is "#"):
    Z = False
    break  
    
if Z:    
  for i in range ( B, D-3):
    if (b[i] is "#") and (b[i+1] is "#"):
      Z = False
      break     
     
if Z and ( C > D):
  for i in range ( B-1, D):
    if (b[i-1] is ".") and (b[i] is ".") and (b[i+1] is "."):
      Z = True
      break
    else :
      Z = False
      
if Z:
  print("Yes")

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map( int, input().split())
b = [ string for string in input()]

Z = True

for i in range ( A, C-3):
  if (b[i] is "#") and (b[i+1] is "#"):
    Z = False
    break

if Z:    
  for i in range ( B, D-3):
    if (b[i] is "#") and (b[i+1] is "#"):
      Z = False
      break
    
if Z and ( C > D):
  for i in range ( B-1, D):
    if (b[i-1] is ".") and (b[i] is ".") and (b[i+1] is "."):
      Z = True
    else :
      Z = False
      
if Z:
  print("Yes")
  
if not Z:
  print("No")

Submission status: Wrong Answer

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

sunuke = A
hunuke = B

def hanteiki():
    if C < D:
        if "##" in S[B:D]:
            return False
        else:
            if "##" in S[A:C]:
                return False
            else:
                return True

    else:
        tmp1 = S[B-1:D+1].count("...")
        tmp2 = S[B-1:D+1].rfind("...")
        if tmp1 > 0:
            if "##" in S[A:C]:
                return False
            else:
                if tmp1 == 1 and tmp2 == D-1:
                    return False
                else:
                    return True
        else:
            return False

if hanteiki():
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

sunuke = A
hunuke = B

def hanteiki():
    if C < D:
        if "##" in S[B:D+1]:
            return False
        else:
            if "##" in S[A:C+1]:
                return False
            else:
                return True

    else:
        if "..." in S[B-1:D+1]:
            if "##" in S[A:C+1]:
                return False
            else:
                return True
        else:
            return False

if hanteiki():
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

sunuke = A
hunuke = B

def hanteiki():
    if C < D:
        if "##" in S[B:D]:
            return False
        else:
            if "##" in S[A:C]:
                return False
            else:
                return True

    else:
        if "..." in S[B-1:D+1]:
            if "##" in S[A:C]:
                return False
            else:
                return True
        else:
            return False

if hanteiki():
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
tmp = input().split()
n=int(tmp[0])
a=int(tmp[1])
b=int(tmp[2])
c=int(tmp[3])
d=int(tmp[4])

tmp = input()

#print("{}{}{}{}{}".format(n,a,b,c,d))
#print(tmp)

#追い越す必要
if(c > d):
	flg=0
	for i in range(b-1,d-1):
		if(tmp[i-1]==".")and(tmp[i]==".")and(tmp[i+1]=="."):
			flg=1
			break
	if(flg!=1):
		print("No")
		sys.exit()

for i in range(a,max(c,d)-1):
	#print("i:{} {}".format(i,i+1))
	if((tmp[i]=="#")and(tmp[i+1]=="#")):
		print("No")
		sys.exit()
print("Yes")

#print(hoge)
#hoge.sort()
#n=len(hoge)
#print(hoge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
tmp = input().split()
n=int(tmp[0])
a=int(tmp[1])
b=int(tmp[2])
c=int(tmp[3])
d=int(tmp[4])

tmp = input()

#print("{}{}{}{}{}".format(n,a,b,c,d))
#print(tmp)

#追い越す必要
if(c > d):
	flg=0
	for i in range(b-1,d-1):
		if(tmp[i-1]==".")and(tmp[i]==".")and(tmp[i+1]=="."):
			flg=1
			break
	if(flg!=1):
		print("No")
		sys.exit()

for i in range(a,max(c,d)-1):
	if(tmp[i]=="#")and(tmp[i+1]=="#"):
		print("No")
		sys.exit()
print("Yes")

#print(hoge)
#hoge.sort()
#n=len(hoge)
#print(hoge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

import sys
tmp = input().split()
n=int(tmp[0])
a=int(tmp[1])
b=int(tmp[2])
c=int(tmp[3])
d=int(tmp[4])

tmp = input()

#print("{}{}{}{}{}".format(n,a,b,c,d))
#print(tmp)

#追い越す必要
if(c > d):
	flg=0
	for i in range(b,d-1):
		if(tmp[i-1]==".")and(tmp[i]==".")and(tmp[i+1]=="."):
			flg=1
			break
	if(flg!=1):
		print("No")
		sys.exit()

for i in range(a,max(c,d)-1):
	if(tmp[i]=="#")and(tmp[i+1]=="#"):
		print("No")
		sys.exit()
print("Yes")

#print(hoge)
#hoge.sort()
#n=len(hoge)
#print(hoge)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-


import sys
tmp = input().split()
n=int(tmp[0])
a=int(tmp[1])
b=int(tmp[2])
c=int(tmp[3])
d=int(tmp[4])

tmp = input()

#print("{}{}{}{}{}".format(n,a,b,c,d))
#print(tmp)

#追い越す必要
if(c > d):
	flg=0
	for i in range(b,d-2):
		if(tmp[i-1]==".")and(tmp[i]==".")and(tmp[i+1]=="."):
			flg=1
			break
	if(flg!=1):
		print("No")
		sys.exit()

for i in range(a,max(c,d)-1):
	if(tmp[i]=="#")and(tmp[i+1]=="#"):
		print("No")
		sys.exit()
print("Yes")

#print(hoge)
#hoge.sort()
#n=len(hoge)
#print(hoge)

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
s=input()+"."
if c<d or (c>d and "..." in s[b:d+1]):
    if "##" not in s[b+1:d+1] and "##" not in s[a:c+1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
s=input()
if c>d:
    k=s[b:d+1].find("...")
    if k>=0 and ("##" not in s[a:b+k]):
        a=k+b+1
        b=k+b+2
        l=c
        c=d
        d=l
if c<d:
    if "##" not in s[b+1:d+1]:
        s=s[:d]+"#"+s[d+1:]
        if "##" not in s[a:c+1] :
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
s=input()
if c>d:
    k=s[b:d+1].find("...")
    if k>=0 and ("##" not in s[a:b+k]):
        a=k+b+1
        b=k+b+2
        l=c
        c=d
        d=l
        print(a,b,c,d)
if c<d:
    if "##" not in s[b+1:d+1]:
        s=s[:d]+"#"+s[d+1:]
        if "##" not in s[a:c+1] :
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
s=input()
if c>d:
    k=s[b:d+1].find("...")
    if k>=0:
        a=k+b+1
        b=k+b+2
        l=c
        c=d
        d=l
if c<d:
    if "##" not in s[b+1:d+1]:
        s=s[:d]+"#"+s[d+1:]
        if "##" not in s[a:c+1] :
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
s=input()
if c>d:
    k=s[b:d+1].find("...")
    if k>0:
        a=k
        b=k+1
        l=c
        c=d
        d=l
if c<d:
    if "##" not in s[b+1:d+1]:
        s=s[:d]+"#"+s[d+1:]
        if "##" not in s[a:c+1] :
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
s=input()
if c<d or (c>d and "..." in s[b:d+1]):
    if "##" not in s[b+1:d+1] and s[d-1]!="#":
        s=s[:d]+"#"+s[d+1:]
        if "##" not in s[a:c+1] and s[c-1]!="#":
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
s=input()
if c<d or (c>d and "..." in s[b:d+1]):
    if "##" not in s[b+1:d+1] and s[d-1]!="#":
        s=s[:d]+"#"+s[d+1:]
        if "##" not in s[a:c+1] and s[c-1]!="#":
            print("YES")
        else:
            print("NO")
    else:
        print("NO")
else:
    print("NO")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
fa=True
fb=True
ff=False
for i in range(a,c-1):
    if s[i]=="#" and s[i+1]=="#":
        fa=False
for i in range(b,d-1):
    if s[i]=="#" and s[i+1]=="#":
        fb=False
if c>d:
    for i in range(b-1,d-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ff=True
if c<d:
    if fa and fb:
        print("Yes")
    else:
        print("No")
else:
    if fa and fb and ff:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
fa=True
fb=True
ff=False
for i in range(a,c-1):
    if s[i]=="#" and s[i+1]=="#":
        fa=False
for i in range(b,d-1):
    if s[i]=="#" and s[i+1]=="#":
        fb=False
if c>d:
    for i in range(b,d-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ff=True
if c<d:
    if fa and fb:
        print("Yes")
    else:
        print("No")
else:
    if fa and fb and ff:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
fa=True
fb=True
ff=False
for i in range(a,c-1):
    if s[i]=="#" and s[i+1]=="#":
        fa=False
for i in range(b,d-1):
    if s[i]=="#" and s[i+1]=="#":
        fb=False
if c>d:
    for i in range(a,d-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ff=True
if c<d:
    if fa and fb:
        print("Yes")
    else:
        print("No")
else:
    if fa and fb and ff:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
fa=True
fb=True
ff=False
for i in range(a,c-1):
    if s[i]=="#" and s[i+1]=="#":
        fa=False
for i in range(b,d-1):
    if s[i]=="#" and s[i+1]=="#":
        fb=False
if c>d:
    for i in range(a,d-2):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            ff=True
if c<d:
    if fa and fb:
        print("Yes")
    else:
        print("No")
else:
    if fa and fb and ff:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
fa=True
fb=True
ff=False
for i in range(a,c-1):
    if s[i]=="#" and s[i+1]=="#":
        fa=False
for i in range(b,d-1):
    if s[i]=="#" and s[i+1]=="#":
        fb=False

for i in range(a,d-2):
    if s[i]=="." and s[i+1]=="." and s[i+2]==".":
        ff=True
if c<d:
    if fa and fb:
        print("Yes")
    else:
        print("No")
else:
    if fa and fb and ff:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def check_double_block(start, end, S):
    for i in range(start, end):
        if S[i] == "#" and S[i+1] == "#":
            return False
    return True

def main():
    N, A, B, C, D = list(map(int, input().split()))
    S = input()

    S = "#" + S + "#"

    if C < D:
        if not check_double_block(A, C, S) or not check_double_block(B, D, S):
            print("No")
        else:
            print("Yes")
    else:
        for i in range(B, D):
            if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
                print("Yes")
                exit()
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def check_double_block(start, end, S):
    for i in range(start, end):
        if i + 1 < len(S):
            if S[i] == "#" and S[i+1] == "#":
                return False
    return True

def main():
    N, A, B, C, D = list(map(int, input().split()))
    S = input()

    if C < D:
        if not check_double_block(A, C, S) or not check_double_block(B, D, S):
            print("No")
        else:
            print("Yes")
    else:
        for i in range(B, D):
            if i + 1 < N:
                if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
                    print("Yes")
                    exit()
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def check_double_block(start, end, S):
    for i in range(start, end-1):
        if S[i] == "#" and S[i+1] == "#":
            return False
    return True

def main():
    N, A, B, C, D = list(map(int, input().split()))
    S = input()

    if C < D:
        if not check_double_block(A, C, S) or not check_double_block(B, D, S):
            print("No")
        else:
            print("Yes")
    else:
        for i in range(B, D):
            if i + 1 < N:
                if S[i-1] == "." and S[i] == "." and S[i+1] == ".":
                    print("Yes")
                    exit()
        print("No")


if __name__ == '__main__':
    main()