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 = map(int,input().split())
s = input()
a-=1
b-=1
d-=1

can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,d):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()
a-=1
b-=1

can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,d):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()

can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,d):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()
a-=1
b-=1
c-=1
d-=1
can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,d):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()
a-=1
b-=1
c-=1
d-=1
can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,c):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()
a-=1
b-=1
c-=1
d-=1
can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,c+1):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()
a-=1
b-=1
c-=1
d-=1
can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef == True:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,c):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()
a-=1
b-=1

can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef == True:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,c):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()

can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef == True:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b-1,c):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            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()

can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

bef = False
for i in range(b,d):
    if s[i] == "#":
        if bef == True:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b,c):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            print("Yes")
        else:
            print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
arr = [False for i in range(n)]
s = input()
for i in range(n):
    if s[i] == ".":
        arr[i] = True

can_reach = True
bef = False
for i in range(a,c):
    if s[i] == "#":
        if bef:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

for i in range(b,d):
    if s[i] == "#":
        if bef == True:
            can_reach = False
        else:
            bef = True
    else:
        bef = False

if can_reach:
    if c < d:
        print("Yes")
    else:
        can_over = False
        bef1 = False
        bef2 = False
        for i in range(b,c):
            if s[i] == ".":
                if bef1:
                    if bef2:
                        can_over = True
                    else:
                        bef2 = True
                else:
                    bef1 = True
            else:
                bef1 = False
                bef2 = False
        if can_over:
            print("Yes")
        else:
            print("No")
else:
    print("No")

Submission status: Wrong Answer

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

if c < d:
    # ふぬけ君を動かす
    for i in range(b, d):
        if s[i] == s[i+1] and s[i] == "#":
            print("No")
            exit()
    # すぬけ君を動かす
    for i in range(a, c):
        if s[i] == s[i+1] and s[i] == "#":
            print("No")
            exit()
    print("Yes")
    exit()

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

Submission status: Wrong Answer

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

if c < d:
    # ふぬけ君を動かす
    for i in range(b, d):
        if s[i] == s[i+1] and s[i] == "#":
            print("No")
            exit()
    # すぬけ君を動かす
    for i in range(a, c):
        if s[i] == s[i+1] and s[i] == "#":
            print("No")
            exit()
    print("Yes")
    exit()

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

Submission status: Wrong Answer

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

for i in range(A,max(C,D)-1):
    if S[i:i+2] == "##":
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B,D):
        if S[i-1:i + 2] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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

for i in range(A,max(C,D)):
    if S[i:i+2] == "##":
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B,D):
        if S[i-1:i + 2] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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

for i in range(max(C,D)):
    if S[i:i+2] == "##":
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B,D):
        if S[i-1:i + 2] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
import copy
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(0)

if C > D:
    flag = False
    for i in range(B,D):
        if S[i-1:i + 2] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
import copy
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(0)

if C > D:
    flag = False
    for i in range(B,C - 3):
        if S[i:i + 3] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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



i = A
j = B

for i in range(max(C,D) - 1):
    if S[i:i+2] == "##":
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B,C - 2):
        if S[i:i + 3] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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



i = A
j = B

for i in range(max(C,D) - 1):
    if S[i:i+2] == "##":
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B,D + 2):
        if S[i:i + 3] == "...":
            flag = True
            break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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



i = A
j = B

for i in range(max(C,D) - 1):
    if S[i:i+2] == "##":
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B,D + 2):
        if S[i:i + 3] == "...":
                flag = True
                break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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



i = A
j = B

for i in range(max(C,D) - 1):
    if S[i:i+2] == "##":
        print("No")
        exit(0)

if C > D:
    flag = False
    for i in range(B,C - 3):
        if S[i:i + 3] == "...":
            if D == S[i] and S[i - 1] == "#":
                continue
            else:
                flag = True
                break

    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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



i = A
j = B

for i in range(max(C,D) - 1):
    if S[i:i+2] == "##":
        print("No")
        exit(0)
if C > D:
    flag = False
    for i in range(N - 3):
        if S[i:i + 3] == "...":
            flag = True
    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

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

i = A
j = B


if C > D:
    flag = False
    for i in range(N - 3):
        if S[i:i + 3] == "...":
            flag = True
    if flag == False:
        print("No")
        exit(0)

print("Yes")

Submission status: Wrong Answer

Solution code:
# 2019/08/29

n,a,b,c,d=map(int,input().split())

s=input()
if c<d:
    flag=True
else:
    flag=False

if flag:
    for i in range(a,d-1):
        if s[i]==s[i+1]=='#':
            print('No')
            exit()
else:
    for i in range(b,d):
        if s[i-2]==s[i-1]==s[i]=='.':
            print('Yes')
            exit()

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

Submission status: Wrong Answer

Solution code:
# 2019/08/29

n,a,b,c,d=map(int,input().split())

s=input()
if c<d:
    flag=True
else:
    flag=False

if flag:
    for i in range(a,d-1):
        if s[i]==s[i+1]=='#':
            print('No')
            exit()
else:
    for i in range(b,d):
        if s[i-1]==s[i]==s[i+1]=='.':
            print('Yes')
            exit()

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

Submission status: Wrong Answer

Solution code:
# 2019/08/29

n,a,b,c,d=map(int,input().split())

s=input()
if (a>b)==(c>d) or (a<b)==(c<d):
    flag=True
else:
    flag=False

if flag:
    for i in range(a,n-2):
        if s[i]==s[i+1]=='#':
            print('No')
            exit()
else:
    for i in range(a,n-3):
        if b<=i+1 and s[i]==s[i+1]==s[i+2]=='.':
            print('Yes')
            exit()

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

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B, C, D = map(int, input().split())
    S = input()
    reachableC, reachableD = True, True
    for i in range(B, D-2):
        if S[i] == "#" and S[i+1] == "#":
            reachableD = False
            break
    for i in range(A, C-2):
        if S[i] == "#" and S[i+1] == "#":
            reachableC == False
            break
    if C < D:
        if reachableC and reachableD:
            return "Yes"
        else:
            return "No"
    else:
        passable = False
        for i in range(B-1, D):
            if S[i-1] == '.' and S[i] == '.' and S[i+1] == '.':
                passable = True
                break
        if passable and reachableC and reachableD:
            return "Yes"
        else:
            return "No"

if __name__ == '__main__':
    print(main())

Submission status: Wrong Answer

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

c = [1 if S[0] == '#' else -1]
for i in range(1, N):
    if c[-1] > 0:
        if S[i] == '#':
            c.append(c[-1] + 1)
        else:
            c.append(-1)
    else:
        if S[i] == '#':
            c.append(1)
        else:
            c.append(c[-1] - 1)

if A < B < C < D:
    ans = max(c[A:D + 1]) <= 1
elif A < B < D < C:
    ans = max(c[A:C + 1]) <= 1 and min(c[B + 1:D + 2]) <= -3
elif A < C < B < D:
    ans = max(c[A:C + 1]) <= 1 and max(c[B:D + 1]) <= 1
print('Yes' if ans else 'No')

Submission status: Wrong Answer

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

def detect(reverse):
    cp = False
    for i in range(a-1, c):
        if i < c-1:
            if s[i] == "#" and s[i+1] == "#": return "No"
        if i < c-2:
            if s[i] == "." and s[i+1] == "." and s[i+2] == ".": cp = True
        
    for i in range(b-1, d):
        if i < d-1:
            if s[i] == "#" and s[i+1] == "#": return "No"
        if i < d-2:
            if s[i] == "." and s[i+1] == "." and s[i+2] == ".": cp = True
    
    return "Yes" if not reverse or cp else "No"

print(detect(c > d))

Submission status: Wrong Answer

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

def detect(reverse):
    cp = False
    for i in range(a-1, c-1):
        if i < c-2:
            if s[i] == "#" and s[i+1] == "#": return "No"
        if i < c-3:
            if s[i] == "." and s[i+1] == "." and s[i+2] == ".": cp = True
        
    for i in range(b-1, d-1):
        if i < d-2:
            if s[i] == "#" and s[i+1] == "#": return "No"
        if i < d-3:
            if s[i] == "." and s[i+1] == "." and s[i+2] == ".": cp = True
    
    return "Yes" if not reverse or cp else "No"

print(detect(c > d))

Submission status: Wrong Answer

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

def detect(reverse):
    cp = False
    for i in range(a-1, d-1):
        if i < d-2:
            if s[i] == "#" and s[i+1] == "#": return "No"
        if i < d-3:
            if s[i] == "." and s[i+1] == "." and s[i+2] == ".": cp = True
    return "Yes" if not reverse or cp else "No"

print(detect(c > d))

Submission status: Wrong Answer

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

    for i in range(a-1, d-1):
        if ss[i:i+2] == '##':
            print('No')
            return

    if c < d:
        print('Yes')
    else:
        for i in range(b-2,d-2):
            if ss[i:i+3] == '...':
                print('Yes')
                return
        print('No')
resolve()

Submission status: Wrong Answer

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

    for i in range(a-1, n-1):
        if ss[i:i+2] == '##':
            print('No')
            return

    if c < d:
        print('Yes')
    else:
        for i in range(b-2,d-2):
            if ss[i:i+3] == '...':
                print('Yes')
                return
        print('No')
resolve()

Submission status: Wrong Answer

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

    for i in range(a-1, n-1):
        if ss[i:i+2] == '##':
            print('No')
            return

    if c < d:
        print('Yes')
    else:
        for i in range(b-2,d-3):
            if ss[i:i+3] == '...':
                print('Yes')
                return
        print('No')
resolve()

Submission status: Wrong Answer

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

    for i in range(a-1, n-1):
        if ss[i:i+2] == '##':
            print('No')
            return

    if c < d:
        print('Yes')
    else:
        for i in range(b-1,d-3):
            if ss[i:i+3] == '...':
                print('Yes')
                return
        print('No')
resolve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def MaxSpace(s, start, end):
    _s = s[start + 1:end]
    _l = _s.split("#")
    _ll = [len(x) for x in _l]
    return max(_ll)

def MaxObstacle(s, start, end):
    _s = s[start + 1:end]
    _l = _s.split(".")
    _ll = [len(x) for x in _l]
    return max(_ll)

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

result = False
if MaxObstacle(s, a, c) < 2 and MaxObstacle(s, b, d) < 2:
    if c < d:
        result = True
    elif MaxSpace(s, b-2, d+2) > 2:
        result = True
if result:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def MaxSpace(s, start, end):
    _s = s[start + 1:end]
    _l = _s.split("#")
    _ll = [len(x) for x in _l]
    return max(_ll)

def MaxObstacle(s, start, end):
    _s = s[start + 1:end]
    _l = _s.split(".")
    _ll = [len(x) for x in _l]
    return max(_ll)

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

result = False
if MaxObstacle(s, a, c) < 2 and MaxObstacle(s, b, d) < 2:
    if c < d:
        result = True
    elif MaxSpace(s, b, d) > 2:
        result = True
if result:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def MaxSpace(s, start, end):
    _s = s[start + 1:end]
    _l = _s.split("#")
    _ll = [len(x) for x in _l]
    return max(_ll)

def MaxObstacle(s, start, end):
    _s = s[start + 1:end]
    _l = _s.split(".")
    _ll = [len(x) for x in _l]
    return max(_ll)

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

result = False
if MaxObstacle(s, a, c) < 2 and MaxObstacle(s, b, d) < 2:
    if c < d:
        result = True
    elif MaxSpace(s, b, c) > 2:
        result = True
if result:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
def solve(A,B,C,D,S):  
  if S[C-1] == "#" or S[D-1] == "#" or "##" in S[A:C-1]or "##" in S[B:D-1]:
    print("No")
    exit()
  if (D<C):
    if "..." not in S[B-1:D+2]:
      print("No")
      exit()
  print("Yes")

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

Submission status: Wrong Answer

Solution code:
def solve(A,B,C,D,S):  
  if S[C-1] == "#" or S[D-1] == "#" or "##" in S[A:C-1]or "##" in S[B:D-1]:
    print("No")
    exit()
  if (D<C):
    if "..." not in S[B-1:D+1]:
      print("No")
      exit()
  print("Yes")

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

Submission status: Wrong Answer

Solution code:
def solve(A,B,C,D,S):  
  if S[C-1] == "#" or S[D-1] == "#" or "##" in S[A:C-1]or "##" in S[B:D-1]:
    print("No")
    exit()
  if (D<C):
    if "..." not in S[B-1:D]:
      print("No")
      exit()
  print("Yes")

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

Submission status: Wrong Answer

Solution code:
def solve(A,B,C,D,S):
  if S[C-1] == "#" or S[D-1] == "#":
    print("No")
    exit()
  
  if "##" in S[A:C-1]or "##" in S[B:D-1]:
    print("No")
    exit()
  if (A<B and D<C):
    if ".." not in S[B:D-1]:
      print("No")
      exit()
  elif (B<A and C<D):
    if ".." not in S[A:C-1]:
      print("No")
      exit()
  print("Yes")

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

Submission status: Wrong Answer

Solution code:
def solve(A,B,C,D,S):
  if "##" in S[A:C] or "##" in S[B:D]:
    print("No")
    exit()
  if (A<B and D<C):
    if ".." not in S[B:D]:
      print("No")
      exit()
  elif (B<A and C<D):
    if ".." not in S[A:C]:
      print("No")
      exit()
  print("Yes")

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

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

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

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

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

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

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

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

if D < C:
#    print(S[A:D])
    if "..." not in S[B-1:D]:
        print("No")
        exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
input=sys.stdin.readline

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

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

if D < C:
#    print(S[A:D])
    if "..." not in S[B-1:D-1]:
        print("No")
        exit()
print("Yes")