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

def max_count(s, to_count):
    max_num = 0
    m = 0
    for c in s:
        if c == to_count:
            m += 1
        else:
            max_num = max(max_num, m)
            m = 0
    max_num = max(max_num, m)
    return max_num

if A > B:
    A, B = B, A
    C, D = D, C

if D < C:
    if max_count(S[A:C], "#") <= 1 and max_count(S[B:D], ".") >= 3:
        print("Yes")
    else:
        print("No")
else:
    if max_count(S[A:C], "#") <= 1 and max_count(S[B:D], "#") <= 1:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]


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

    if "##" in s[a:c] and "##" in s[b:d]:
        print("No")
        sys.exit()

    if c < d:
        print("Yes")
        sys.exit()

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys


def input():
    return sys.stdin.readline()[:-1]


def main():
    n, a, b, c, d = map(int, input().split())
    s = input()
    first = a if a < b else b
    last = c if c > d else d

    if "##" in s[first:last]:
        print("No")
        sys.exit()

    if c < d:
        print("Yes")
        sys.exit()

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


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    for i in range(B-1,D-1):
        if S[i]==".":
            if S[i]==S[i+1] and S[i+1]==S[i+2]:
                a=0
                break
for i in range(N-1):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    for i in range(B,D-3):
        if S[i]==".":
            if S[i]==S[i+1] and S[i+1]==S[i+2]:
                a=0
                break
for i in range(N-1):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    for i in range(B,D-2):
        if S[i]==".":
            if S[i]==S[i+1] and S[i+1]==S[i+2]:
                a=0
                break
for i in range(N-1):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D=map(int,input().split())
S=list(input())
a=0
if C>D:
    for i in range(N-3):
        if S[i]=="#":
            for j in range(1,4):
                if S[i]==S[i+j]:
                    a=1
    for i in range(N-2):
        if S[i]==".":
            if S[i]==S[i+1] and S[i+1]==S[i+2]:
                a=0
                break
for i in range(N-1):
    if S[i]=="#":
        if S[i+1]=="#":
            a=1
if a==0:
    print("Yes")
if a==1:
    print("No")

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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


for i in range(A,max(C,D)):
    if S[i] == S[i+1] and S[i+1] == '#':
        print("No")
        quit()
if  C < D:
    print("Yes")
elif 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+2] == '.':
            print("Yes")
            quit()
    print("No")

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

if C > D:
    start = max(B - 3, 0)
    end = min(D + 2, N - 1)
    passing = "..." in S[start:end]
    possible = sunuke_possible * funuke_possible * passing
else:
    possible = sunuke_possible * funuke_possible

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

Submission status: Wrong Answer

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

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

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

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

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if B < C < D :
    count = 0
    for i in range(A, D-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C < B < D :
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    for j in range(B, D-1):
        if S_list[j] == S_list[j+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else :
        print('Yes')
elif B < D < C:
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    cou = 0
    for i in range(B-2, D-1):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            cou += 1
    if cou >= 1:
        print('Yes')  
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if B < C < D :
    count = 0
    for i in range(A, D-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C < B < D :
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    for j in range(B, D-2):
        if S_list[j] == S_list[j+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else :
        print('Yes')
else:
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    count = 0
    for i in range(B-2, D-1):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            count += 1
    if count >= 1:
        print('Yes')  
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if C < D :
    count = 0
    for i in range(A, D-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C == D :
    print('No')
else:
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    count = 0
    for i in range(B-2, D-1):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            count += 1
    if count >= 1:
        print('Yes')  
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if C < D :
    count = 0
    for i in range(A-1, D-1):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C == D :
    print('No')
else:
    count = 0
    for i in range(A-1, C-1):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    count = 0
    for i in range(B-2, D-1):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            count += 1
    if count >= 1:
        print('Yes')  
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if C < D :
    count = 0
    for i in range(A-1, D-1):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C == D :
    print('No')
else:
    count = 0
    for i in range(A-1, C-1):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    count = 0
    for i in range(B-2, D-2):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            count += 1
    if count >= 1:
        print('Yes')  
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if C < D :
    count = 0
    for i in range(A-1, D-1):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C == D :
    print('No')
else:
    count = 0
    for i in range(A-1, C-1):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    count = 0
    for i in range(B-1, D-2):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            count += 1
    if count >= 1:
        print('Yes')  
    else:
        print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if C<D:
  if '##' not in S:
    print('Yes')
  else:
    print('No')
else:
  if '##' not in S and '...' in S[B-1:D]:
    print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

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

if C<D:
  if '##' not in S:
    print('Yes')
  else:
    print('No')
else:
  if '##' not in S and '...' in S:
    print('Yes')
  else:
    print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
    flag = "Yes"
    for i in range(x-1 ,y-2):
        if S[i] ==  S[i+1] == "#":
            flag = "No"
    return flag

def judgeJumpOver(S, x , y):
    flag = "No"
    for i in range(x-1 ,y):
        if S[i-1] ==  S[i] ==  S[i+1] == ".":
            flag = "Yes"
        break
    return flag
 
result = "Yes"
if(C > D):
    result = judgeJumpOver(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
  flag = "Yes"
  for i in range(x-1 ,y-2):
    if S[i] ==  S[i+1] == "#":
        flag = "No"
  return flag

def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y-1):
    if S[i-1] ==  S[i] ==  S[i+1] == ".":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x , y):
  flag = "Yes"
  for i in range(x-1 ,y - 2):
    if S[i:i+2] == "##":
        flag = "No"
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x-1 ,y - 1):
    if S[i-1:i+2] == "...":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x , y):
  flag = "Yes"
  for i in range(x ,y - 2):
    if S[i-1:i+1] == "##":
        flag = "No"
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x ,y - 1):
    if S[i-2:i+1] == "...":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x , y):
  flag = "Yes"
  for i in range(x ,y - 2):
    if S[i:i+2] == "##":
        flag = "No"
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x ,y - 1):
    if S[i-1:i+2] == "...":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x , y):
  flag = "Yes"
  while flag == "Yes" and (not x == y):
    if S[x:x+2] == "##":
        flag = "No"
    elif S[x:x+2] == "#.":
        x +=2
    elif S[x:x+2] == "..":
        x +=2
    elif S[x:x+2] == ".#":
        x +=1
    else:
        x +=1
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(x ,y - 1):
    if S[i-1:i+2] == "...":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

Solution code:
N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x , y):
  flag = "Yes"
  while flag == "Yes" and (not x == y):
    if S[x:x+2] == "##":
        flag = "No"
    elif S[x:x+2] == "#.":
        x +=2
    elif S[x:x+2] == "..":
        x +=2
    elif S[x:x+2] == ".#":
        x +=1
    else:
        x +=1
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for x in range(y - 2):
    if S[x:x+3] == "...":
      flag = "Yes"
      break
 
  return flag
 
result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

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

def judgeArrive(S, x , y):
  flag = "Yes"
  while flag == "Yes" and (not x == y):
    if S[x:x+2] == "##":
        flag = "No"
    elif S[x:x+2] == "#.":
        x +=2
    elif S[x:x+2] == "..":
        x +=2
    elif S[x:x+2] == ".#":
        x +=1
    else:
        x +=1
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for x in range(y - 2):
    if S[x:x+3] == "...":
      flag = "Yes"
      break

  return flag

result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

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

def judgeArrive(S, x , y):
  flag = "Yes"
  while flag == "Yes" and (not x == y):
    if S[x:x+2] == "##":
        flag = "No"
        print(x)
    elif S[x:x+2] == "#.":
        x +=2
        print(x)
    elif S[x:x+2] == "..":
        x +=2
        print(x)
    elif S[x:x+2] == ".#":
        x +=1
        print(x)
    else:
        x +=1
        print(x)
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for x in range(y - 2):
    if S[x:x+3] == "...":
      flag = "Yes"
      print(flag)
      print(S[x:x+3])
      break
    print(S[x:x+3])

  return flag

result = "Yes"
if(C > D):
  result = judgeJumpOver(S, B, D)
print(result)
if(result == "Yes"):
  result = judgeArrive(S, B, D)
print(result)
if(result == "Yes"):
  result = judgeArrive(S, A, C)
print(result)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def judgeArrive(S, x , y):
  flag = "Yes"
  while flag == "Yes" and (not x == y):
    if S[x:x+2] == "##":
        flag = "No"
        print(x)
    elif S[x:x+2] == "#.":
        x +=2
        print(x)
    elif S[x:x+2] == "..":
        x +=2
        print(x)
    elif S[x:x+2] == ".#":
        x +=1
        print(x)
    else:
        x +=1
        print(x)
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(y - 2):
    if S[x:x+3] == "...":
      flag = "Yes"
      break
  return flag

flag = "Yes"
if(C > D):
  flag = judgeJumpOver(S, B, D)
if(flag == "Yes"):
  flag = judgeArrive(S, B, D)
if(flag == "Yes"):
  flag = judgeArrive(S, A, C)
print(flag)

Submission status: Wrong Answer

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


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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def judgeArrive(S , x , y):
  flag = "Yes"
  while flag == "Yes" and (not x == y):
    if S[x:x+2] == "##":
        flag = "No"
        print(x)
    elif S[x:x+2] == "#.":
        x +=2
        print(x)
    elif S[x:x+2] == "..":
        x +=2
        print(x)
    elif S[x:x+2] == ".#":
        x +=1
        print(x)
    else:
        x +=1
        print(x)
  return flag
        
def judgeJumpOver(S, x , y):
  flag = "No"
  for i in range(y - 2):
    if S[x:x+3] == "...":
      flag = "Yes"
      break
  return flag

flag = "Yes"
if(C > D):
  flag = judgeJumpOver(S, B, D)
flag = judgeArrive(S, B, D)
flag = judgeArrive(S, A, C)
print(flag)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

flag = 0

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

Submission status: Wrong Answer

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

flag = 0

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

Submission status: Wrong Answer

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

flag = 0

if c < d:
    for i in range(a, d-1):
        if s[i] == s[i+1] == "#":
            flag = 1
            break
else:
    for i in range(a, d-1):
        if s[i] == s[i+1] == "#":
            flag = 1
            break
        else:
            for i in range(a,c-1):
                if s[i-1] == s[i+1] == s[i] ==".":
                    pass
                else:
                    flag = 1
    
if flag == 1:
    print("No")
else:
    print("Yes")

Submission status: Wrong Answer

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

flag = 0

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

Submission status: Wrong Answer

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

flag = 0

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

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

bo = step(A,C) and step(B,D)            
if bo and pass_path == 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(a-1,c-1):
  if s[i:i+2]=='##':
    print('No')
    exit()
for i in range(b-1,d-1):
  if s[i:i+2]=='##':
    print('No')
    exit()
if c<d:
  print('Yes')
else:
  for i in range(b-2,c-1):
    if s[i:i+3]=='...':
      print('Yes')
      exit()
  print('No')

Submission status: Wrong Answer

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