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:
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    for i in range(a - 1, c):
        if s[i:i + 1] == "##":
            print("No")
            return 0
    for i in range(b - 1, d):
        if s[i:i + 1] == "##":
            print("No")
            return 0

    if c < d:
        print("Yes")
    else:
        if "..." in s[b - 2:d + 1]:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    for i in range(a - 1, c - 1):
        if s[i:i + 1] == "##":
            print("No")
            return 0
    for i in range(b - 1, d - 1):
        if s[i:i + 1] == "##":
            print("No")
            return 0

    if c < d:
        print("Yes")
    else:
        if "..." in s[b - 2:d + 1]:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    for i in range(a - 1, c - 1):
        if s[i:i + 1] == "##":
            print("No")
            return 0
    for i in range(b - 1, d - 1):
        if s[i:i + 1] == "##":
            print("No")
            return 0

    if c < d:
        print("Yes")
    else:
        if "..." in s[b - 1:d + 2]:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    for i in range(a - 1, c - 1):
        if s[i:i + 1] == "##":
            print("No")
            return 0
    for i in range(b - 1, d - 1):
        if s[i:i + 1] == "##":
            print("No")
            return 0

    if c < d:
        print("Yes")
    else:
        if "..." in s[b - 1:d + 1]:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    if "#" in [s[a - 1], s[b - 1], s[c - 1], s[d - 1]]:
        print("No")
        return 0
    for i in range(a - 1, c):
        if s[i:i + 1] == "##":
            print("No")
            return 0
    for i in range(b - 1, d):
        if s[i:i + 1] == "##":
            print("No")
            return 0

    if c < d:
        print("Yes")
    else:
        if "..." in s[b - 1:d + 1]:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    if "#" in [s[a - 1], s[b - 1], s[c - 1], s[d - 1]]:
        print("No")
        return 0

    if "##" in s:
        print("No")
    elif d > c:
        print("Yes")
    else:
        if "..." in s[b - 2:min(c, d) + 1]:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    if "#" in [s[a - 1], s[b - 1], s[c - 1], s[d - 1]]:
        print("No")
        return 0
    
    if "##" in s:
        print("No")
    else:
        if c > d:
            if "..." in s:
                print("Yes")
            else:
                print("No")
        else:
            print("Yes")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    n, a, b, c, d = list(map(int, input().split()))
    s = input()
    if "##" in s:
        print("No")
    else:
        if c > d:
            if "..." in s:
                print("Yes")
            else:
                print("No")
        else:
            print("Yes")


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

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

a -= 1; b -= 1; c -= 1; d -= 1

#ABCD
if c < d:
    for i in range(a, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b, c):
        if s[i-1] == "." and s[i] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, d-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    for j in range(a, c-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()       
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b, c-1):
        if s[i-1] == "." and s[i] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, d-1):
        if s[i] == "#" and s[i+1] == "#":
            flag_b = False

    flag_c = True
    for i in range(b, c-1):
        if s[i] == "#" and s[i+1] == "#":
            flag_c = False        

    if flag_a and flag_b and flag_c:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(a, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b, c-1):
        if s[i-1] == "." and s[i] == "." and s[i+1] == ".":
            flag_a = True

    s = s[:c] + "#" + s[c+1:]
    flag_b = True
    for i in range(a, d-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(a, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b, c-1):
        if s[i-1] == "." and s[i] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, d-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(a, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b, d-1):
        if s[i-1] != a and s[i-1] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, d-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(a, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b, d-1):
        if s[i-1] != a and s[i-1] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b, d-1):
        if s[i-1] != a and s[i-1] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b, d-1):
        if s[i-1] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b+1, d-1):
        if s[i-1] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

#ABCD
if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")
    exit()

#ABDC
elif d < c:
    flag_a = False
    for i in range(b+1, d-2):
        if s[i-1] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b+1, d-2):
        if s[i-1] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

#ABDC
elif d < c:
    flag_a = False
    for i in range(b+1, d-2):
        if s[i] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

elif d < c:
    flag_a = False
    for i in range(b+1, d-1):
        if s[i] == "." and s[i+1] == ".":
            flag_a = True

    flag_b = True
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                flag_b = False

    if flag_a and flag_b:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

a -= 1
b -= 1
c -= 1
d -= 1

if c < d:
    for i in range(b, d-1):
        if s[i] == "#" and s[i+1] == "#":
            print("No")
            exit()
    print("Yes")

else:
    for i in range(a, c-1):
            if s[i] == "#" and s[i+1] == "#":
                print("No")
                exit()
    
    flag = False
    for j in range(b+1, d-1):
        if s[j] == "." and s[j+1] == ".":
            flag  = True

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans='Yes'
if d>c:
    check=0
    for i in range(a,d):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
else:
    check=0
    for i in range(a,c):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
    check=0
    for i in range(b-2,d):
        if s[i]=='.':
            check+=1
            if check==3:
                break
        else:
            check=0
    if check!=3:
        ans='No'
print(ans)

Submission status: Wrong Answer

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

ans='Yes'
if d>c:
    check=0
    for i in range(a,n):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
else:
    check=0
    for i in range(a,n):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
    check=0
    for i in range(b-2,n):
        if s[i]=='.':
            check+=1
            if check==3:
                break
        else:
            check=0
    if check!=3:
        ans='No'
print(ans)

Submission status: Wrong Answer

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

ans='Yes'
if d>c:
    check=0
    for i in range(a,n):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
else:
    check=0
    for i in range(a,n):
        if s[i]=='.':
            check=0
        else:
            check+=1
            if check==2:
                ans='No'
    check=0
    for i in range(b-2,n):
        if s[i]=='.':
            check+=1
            print(check)
            if check==3:
                break
        else:
            check=0
    if check!=3:
        ans='No'
print(ans)

Submission status: Wrong Answer

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

if '#' in [S[A-1], S[B-1], S[C-1], S[D-1]]:
    ans = 'No'
elif '##' in S[A-1:C] or '##' in S[B-1:D]:
    ans = 'No'
elif A < B and C > D:
    if '...' not in S[B-1:D-1]:
        ans = 'No'

print(ans)

Submission status: Wrong Answer

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

if '#' in [S[A-1], S[B-1], S[C-1], S[D-1]]:
    ans = 'No'
elif '##' in S[A-1:C] or '##' in S[B-1:D]:
    ans = 'No'
elif A < B and C > D:
    if '...' not in S[B-1:D]:
        ans = 'No'

print(ans)

Submission status: Wrong Answer

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

if '#' in [S[A-1], S[B-1], S[C-1], S[D-1]]:
    ans = 'No'
elif '##' in S[A-1:C] or '##' in S[B-1:D]:
    ans = 'No'
elif A < B and C > D:
    if '...' not in S[A-1:D]:
        ans = 'No'

print(ans)

Submission status: Wrong Answer

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

if '#' in [S[A-1], S[B-1], S[C-1], S[D-1]]:
    ans = 'No'
elif '##' in S[A-1:C] or '##' in S[B-1:D]:
    ans = 'No'
elif A < B and C > D:
    if '...' not in S[A-1:C]:
        ans = 'No'

print(ans)

Submission status: Wrong Answer

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

if (b-a)*(d-c)>0 and max(a,b) < min(c,d):
  for i in range(min(a,b),max(c,d)):
    if s[i]=='#' and s[i+1]=='#':
      print('No')
      exit()
  print('Yes')

elif (b-a)*(d-c)>0 and max(a,b) > min(c,d):
  for i in range(a,c):
    if s[i]=='#' and s[i+1]=='#':
      print('No')
      exit()
  for i in range(b,d):
    if s[i]=='#' and s[i+1]=='#':
      print('No')
      exit()
  print('Yes')
 
else:
  for i in range(min(a,b),max(c,d)):
    if s[i]=='#' and s[i+1]=='#':
      print('No')
      exit()
  for i in range(max(a,b),min(c,d)):
    if s[i-1]=='.' and s[i]=='.' and s[i+1]=='.':
      print('Yes')
      exit()
  print('No')

Submission status: Wrong Answer

Solution code:
import re
n,a,b,c,d=map(int,input().split())
s=input()
if re.search('##',s):
    print('No')
if c > d:
    if re.search('(#)?\.\.\.(#)?', s[b:d+1]):
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import re
n,a,b,c,d=map(int,input().split())
s=input()
if re.search('##',s):
    print('No')
if c > d:
    if re.search('(#)?\.\.\.(#)?', s):
        print('Yes')
    else:
        print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
import re
n,a,b,c,d=map(int,input().split())
s=input()
if re.search('##',s):
    print('No')
if c > d:
    if re.search('#\.\.\.#', s):
        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()
s = "." + s

def aa():
    for i in range(a, c-1):
        if s[i:i+2] == "##":
            return "No"
    for i in range(b, d-1):
        if s[i:i+2] == "##":
            return "No"
    if c > d:
        for i in range(b-1, d-1):
            if s[i:i+3] == "...":
                return "Yes"
        return "No"
    else:
        return "Yes"

print(aa())

Submission status: Wrong Answer

Solution code:
N,A,B,C,D=map(int,input().split())
S='.'+input() # 便宜上，S[0]='.'とし，問題文のi-initialに合わせる

if D<C:
    f=False
    for i in range(B-1,D):
        if S[i:i+3]=='...':
            f=True
else:
    f=True

if f:
    for i in range(A+1,C-1):
        if S[i:i+2]=='##':
            f=False

print('Yes' if f else 'No')

Submission status: Wrong Answer

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

if "##" in S:
  print("No")
elif D>C:
  print("Yes")
else:
  if "..." in S[B-1:min(C,D)]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

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

if "##" in S:
  print("No")
elif D>C:
  print("Yes")
else:
  if "..." in S[B-1:]:
    print("Yes")
  else:
    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]==s[i+1]=="#":
		print("No")
		exit()
three=0
s="#"+s+"#"
for i in range(b,d+1):
	if s[i]==s[i+1]==s[i-1]==".":
		three=True
if c<d:
	print("Yes")
elif three==True:
	print("Yes")
else:
	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]==s[i+1]=="#":
		print("No")
		exit()
three=0
s="#"+s+"#"
for i in range(b,d):
	if s[i]==s[i+1]==s[i-1]==".":
		three=True
if c<d:
	print("Yes")
elif three==True:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()
p=[]
cnt=0
for i in range(n):
	if s[i]==".":
		cnt+=1
	else:
		p.append(cnt)
		cnt=0
if cnt>0:
	p.append(cnt)
zero=0
three=0
cross=0
if d<c:
	cross=True
rr=0
for i in range(len(p)):
	if p[i]==0:
		zero=True
		break
	elif p[i]>=3:
		rr=1
if rr==1:
	s="#"+s+"#"
	for i in range(b,d):
		if s[i]==s[i+1]==s[i-1]==".":
			three=True
			break
if zero==True:
	print("No")
elif three==True or cross==False:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()
p=[]
cnt=0
for i in range(n):
	if s[i]==".":
		cnt+=1
	else:
		p.append(cnt)
		cnt=0
if cnt>0:
	p.append(cnt)
zero=0
three=0
cross=0
if d<c:
	cross=True
rr=0
for i in range(len(p)):
	if p[i]==0:
		zero=True
		break
	elif p[i]>=3:
		rr=1
if rr==1:
	s="#"+s+"#"
	for i in range(b,d):
		if s[i]==s[i+1]==s[i-1]==".":
			three==True
			break
if zero==True:
	print("No")
elif three==True or cross==False:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()
p=[]
cnt=0
for i in range(n):
	if s[i]==".":
		cnt+=1
	else:
		p.append(cnt)
		cnt=0
if cnt>0:
	p.append(cnt)
zero=0
three=0
cross=0
if d<c:
	cross=True
for i in range(len(p)):
	if p[i]==0:
		zero=True
		break
	elif p[i]>=3:
		three=True
if zero==True:
	print("No")
elif three==True or cross==False:
	print("Yes")
else:
	print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
import copy
s=input()
p=[]
cnt=0
for i in range(n):
	if s[i]==".":
		cnt+=1
	else:
		p.append(cnt)
		cnt=0
if cnt>0:
	p.append(cnt)
k=[a,b,c,d]
e=[]
for i in range(4):
	w=0
	q=copy.deepcopy(p)
	for j in range(n):
		if k[i]-1==j:
			e.append(w)
			break
		if q[w]>0:
			q[w]-=1
		else:
			w+=1
if p.count(0)!=0:
	print("No")
	exit()
# print(p)
# print(e)
cross=False
if d<c:
	cross=True
if cross==False:
	print("Yes")
	exit()
for i in range(len(p)):
	if p[i]>=3:
		print("Yes")
		exit()
print("No")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = map(int, input().split())
s = input().rstrip()
if c < d:
    s = s[a:d]
    for c0, c1 in zip(s, s[1:]):
        if c0 == c1 == '#':
            print('No')
            break
    else:
        print('Yes')
else:
    ok = False
    for i in range(b - 1, d):
        if i + 2 < n and s[i] == s[i + 1] == s[i + 2] == '.':
            ok = True
            break
    else:
        print('No')
    if ok:
        s = s[a:c]
        for c0, c1 in zip(s, s[1:]):
            if c0 == c1 == '#':
                print('No')
                break
        else:
            print('Yes')

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,A,B,C,D=map(int,input().split())
S=input()
A-=1
B-=1
C-=1
D-=1

"""
ABDCとか順番が逆転するなら3つ以上連続の空きがないとアウト
ABCDならAからDにいけないとアウト ACBDの可能性があるので注意
"""
if C<=D:
    if C<=B:
        if "##" in S[A:C+1] or "##" in S[B:D+1]:#ACBD
            print("No")
        else:
            print("Yes")
    else:
        if "##" in S[A:D+1]:#ABCD
            print("No")
        else:
            print("Yes")
else:
    if "..." in S[A:C+1] and not "##" in S[A:C+1]:#ABDC
        if S[B+1]=="#" and not "..." in S[B:C+1]:#A.B#..#..#..対策
            print("No")
        else:
            print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,A,B,C,D=map(int,input().split())
S=input()
A-=1
B-=1
C-=1
D-=1

"""
ABDCとか順番が逆転するなら3つ以上連続の空きがないとアウト
ABCDならAからDにいけないとアウト ACBDの可能性があるので注意
"""
if C<D:
    if C<B:
        if "##" in S[A:C+1] or "##" in S[B:D+1]:#ACBD
            print("No")
        else:
            print("Yes")
    else:
        if "##" in S[A:D+1]:#ABCD
            print("No")
        else:
            print("Yes")
else:
    if "..." in S[A:C+1] and not "##" in S[A:C+1]:#ABDC
        if S[B+1]=="#" and not "..." in S[B:C+1]:
            print("No")
        else:
            print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,A,B,C,D=map(int,input().split())
S=input()
A-=1
B-=1
C-=1
D-=1

"""
ABDCとか順番が逆転するなら3つ以上連続の空きがないとアウト
ABCDならAからDにいけないとアウト ACBDの可能性があるので注意
"""
if C<D:
    if C<B:
        if "##" in S[A:C+1] or "##" in S[B:D+1]:#ACBD
            print("No")
        else:
            print("Yes")
    else:
        if "##" in S[A:D+1]:#ABCD
            print("No")
        else:
            print("Yes")
else:
    if "..." in S[A:C+1] and not "##" in S[A:C+1]:#ABDC
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,A,B,C,D=map(int,input().split())
S=input()
A-=1
B-=1
C-=1
D-=1

"""
ABDCとか順番が逆転するなら3つ以上連続の空きがないとアウト
ABCDならAからDにいけないとアウト ACBDの可能性があるので注意
"""
if C<D:
    if C<B:
        if "##" in S[A:C+1] or "##" in S[B:D+1]:#ACBD
            print("No")
        else:
            print("Yes")
    else:
        if "##" in S[A:D+1]:#ABCD
            print("No")
        else:
            print("Yes")
    
else:
    if "..." in S[B:C+1] and not "##" in S[A:C+1]:#ABDC

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
N,A,B,C,D=map(int,input().split())
S=input()

"""
ABDCとか順番が逆転するなら3つ以上連続の空きがないとアウト
ABCDならAからDにいけないとアウト ACBDの可能性があるので注意
"""
if C<D:
    if C<B:
        if "##" in S[A:C+1] or "##" in S[B:D+1]:#ACBD
            print("No")
        else:
            print("Yes")
    else:
        if "##" in S[A:D+1]:#ABCD
            print("No")
        else:
            print("Yes")
    
else:
    if "..." in S[A:C+1] and not "##" in S[A:C+1]:#ABDC
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

con = True
for i in range(a,d+1):
    if s[i-1]=="#" and s[i]=="#":
        print("No")
        con = False
        break

if (con):
    if (c<b) or (c<d):
        print("Yes")
        con = False

if (con):
    rck = min(c,d)
    for i in range(b-1,rck-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            con = False
            break

if (con):
    print("No")

Submission status: Wrong Answer

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

con = True
for i in range(a,d+1):
    if s[i-1]=="#" and s[i]=="#":
        print("No")
        con = False
        break

if (con):
    if (c<b) or (c<d):
        print("Yes")
        con = False

if (con):
    rck = min(c,d)
    for i in range(b,rck-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            con = False
            break

if (con):
    print("No")

Submission status: Wrong Answer

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

con = True
for i in range(a,d):
    if s[i-1]=="#" and s[i]=="#":
        print("No")
        con = False
        break

if (con):
    if (c<b) or (c<d):
        print("Yes")
        con = False

if (con):
    rck = min(c,d)
    for i in range(b,rck-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print("Yes")
            con = False
            break

if (con):
    print("No")

Submission status: Wrong Answer

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

con = True
for i in range(a,d):
    if s[i-1]=="#" and s[i]=="#":
        print("No")
        con = False
        break

if (con):
    if (c<b) or (c<d):
        print("Yes")
        con = False

if (con):
    rck = min(c,d)
    for i in range(b,rck-1):
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            print(s[i],i)
            print("Yes")
            con = False
            break
        
if (con):
    print("No")

Submission status: Wrong Answer

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

if c < d:
    print("Yes")
else:
    tmp = s.split("#")
    ans = "No"
    for i in tmp:
        if len(i) >= 3:
            ans = "Yes"
            break
    print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
A, B, C, D = A-1, B-1, C-1, D-1
if C < D:
  if "##" in S[A:D+1]:
    print("No")
  else:
    print("Yes")
else:
  if "##" in S[A:C+1]:
    print("No")
  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 = input()
A, B, C, D = A-1, B-1, C-1, D-1
if C < D:
  if "##" in S[A:D+2]:
    print("No")
  else:
    print("Yes")
else:
  if "##" in S[A:C+2]:
    print("No")
  elif "..." in S[B:D+3]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
A, B, C, D = A-1, B-1, C-1, D-1
if C < D:
  if "##" in S[A:D+1]:
    print("No")
  else:
    print("Yes")
else:
  if "##" in S[A:C+1]:
    print("No")
  elif "..." 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()
A, B, C, D = A-1, B-1, C-1, D-1
if C < D:
  if "##" in S[A:D+1]:
    print("No")
  else:
    print("Yes")
else:
  if "##" in S[A:C+1]:
    print("No")
  elif "..." in S[B:D+1]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
A, B, C, D = A-1, B-1, C-1, D-1
if C < D:
  if "##" in S[A:D]:
    print("No")
  else:
    print("Yes")
else:
  if "##" in S[A:C]:
    print("No")
  elif "..." in S[B:D]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

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

if "##" in S[A:C+1] or "##" in S[B:D+1]:
  print("No")
  exit()


# A B C D
# A C B D
if C < D:
  print("Yes")
  exit()

# A B D C  
else:
  if "..." in S[B-1:D+2]:
    print("Yes")
  else:
    print("No")