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()
s=list(S.split("#"))

answer="Yes"

if (A>B and C>D) or (A<B and C<D):
    if "##" in S[min(A,C):max(A,C)]:
        answer="No"
    elif "##" in S[min(B,D):max(B,D)]:
        answer="No"
else:
    if "..." not in S:
        answer="No"
    else:
        dots=[i for i, x in enumerate(s) if x =="..."]
        for j in dots:
            if "##" in S[min(A,B,C,D,j):max(A,B,C,D,j)]:
                answer="No"
            else:
                answer="Yes"
                break
print(answer)

Submission status: Wrong Answer

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

answer="Yes"

if (A>B and C>D) or (A<B and C<D):
    if "##" in S[min(A,C):max(A,C)]:
        answer="No"
    elif "##" in S[min(B,D):max(B,D)]:
        answer="No"
else:
    if "..." not in S:
        answer="No"
    else:
        dots=[i for i, x in enumerate(s) if x =="..."]
        for j in dots:
            if "##" not in S[min(A,B,C,D,j):max(A,B,C,D,j)]:
                answer="No"
            else:
                answer="Yes"
                break
print(answer)

Submission status: Wrong Answer

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

answer="Yes"

if (A>B and C>D) or (A<B and C<D):
    if "##" in S[min(A,C):max(A,C)]:
        answer="No"
    elif "##" in S[min(B,D):max(B,D)]:
        answer="No"
else:
    if "..." not in S:
        answer="No"
    else:
        dots=[i for i, x in enumerate(s) if x =="..."]
        dots+=[A,B,C,D]
        if "##" in S[min(dots):max(dots)]:
            answer="No"
print(answer)

Submission status: Wrong Answer

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

answer="Yes"

if (A>B and C>D) or (A<B and C<D):
    if (min(A,C)<min(B,D) and max(A,C)>max(B,C)) or ((min(A,C)>min(B,D) and max(A,C)<max(B,C))):
        if "..." not in S:
            answer="No"
        else:
            dots=[i for i, x in enumerate(s) if x =="..."]
            dots+=[A,B,C,D]
            if "##" in S[min(dots):max(dots)]:
                answer="No"
    else:    
        if "##" in S[min(A,C):max(A,C)]:
            answer="No"
        elif "##" in S[min(B,D):max(B,D)]:
            answer="No"
else:
    if "..." not in S:
            answer="No"
    else:
            dots=[i for i, x in enumerate(s) if x =="..."]
            dots+=[A,B,C,D]
            if "##" in S[min(dots):max(dots)]:
                answer="No"
print(answer)

Submission status: Wrong Answer

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

answer="Yes"
possibility=True

if (A>B and C>D) or (A<B and C<D):
    if "##" in S[min(A,C):max(A,C)]:
        answer="No"
    elif "##" in S[min(B,D):max(B,D)]:
        answer="No"
else:
    if "..." not in S:
            answer="No"

print(answer)

Submission status: Wrong Answer

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

answer="Yes"
possibility=True

if (A>B and C>D) or (A<B and C<D):
    for i in range(A,C):
        if S[i:i+1]=="##":
            answer="No"
    for j in range(B,D):
        if S[i:i+1]=="##":
            answer="No"
else:
    if "..." not in S:
            answer="No"

print(answer)

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = "#" + input() + "#"
    if "##" in S[A:C+1] or "##" in S[B:D+1]:
        return print("No")
    if D < C and "..." not in S[B:D+1]:
        return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "##" in S[A:C] or "##" in S[B:D]:
        return print("No")
    if D < C and ((S[B-2] != "." or S[B] != ".") and "..." not in S[B-1:D]):
        return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "##" in S[A:C] or "##" in S[B:D]:
        return print("No")
    if D < C and "..." not in S[B-2:D]:
        return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "##" in S[A-1:C] or "##" in S[B-1:D]:
        return print("No")
    if D < C and "..." not in S[B-1:D]:
        return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "##" in S[A:C] or "##" in S[B:D]:
        return print("No")
    if D < C and "..." not in S[B:D]:
        return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "##" in S[A:C] or "##" in S[B:D]:
        return print("No")
    if D < C and (S[D-2] == "#" or S[D] == "#"):
        if (S[B-2] == "#" or S[B] == "#") and "..." not in S[B:D]:
            return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
def main():
    N, A, B, C, D = (int(i) for i in input().split())
    S = input()
    if "##" in S[A-1:C] or "##" in S[B-1:D]:
        return print("No")
    if D < C and ((0 <= D-2 and S[D-2] == "#") or S[D] == "#"):
        if (0 <= B-2 and S[B-2] == "#") or S[B] == "#":
            return print("No")
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
p = 0
t = 0
sti = 0
for i in range(A-1, max(C, D) - 1):
  if S[i:i+2] == '##':
    p = 1
for j in range(B-1, min(C, D) - 2):  
  if S[j:j+3] == '...':
    if sti == 0:
      sti = j + 1
    t = 1
if S[B] == '.' and S[B-2] == '.':
  t = 1
if (C < D and p == 0) or (C > D and p == 0 and t == 1 and sti <= D-1):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
p = 0
t = 0
sti = 0
for i in range(A-1, max(C, D) - 1):
  if S[i:i+2] == '##':
    p = 1
for j in range(B-1, min(C, D) - 2):  
  if S[j:j+3] == '...':
    if sti == 0:
      sti = j + 1
    t = 1
if S[B] == '.' and S[B-2] == '.':
  t = 1
if (C < D and p == 0) or (C > D and p == 0 and t == 1 and sti <= C-1):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
p = 0
t = 0
sti = 0
for i in range(A-1, max(C, D) - 1):
  if S[i:i+2] == '##':
    p = 1
for j in range(B-1, min(C, D) - 2):  
  if S[j:j+3] == '...':
    if sti == 0:
      sti = j + 1
    t = 1
if S[B] == '.' and S[B-2] == '.':
  t = 1
if (C < D and p == 0) or (C > D and p == 0 and t == 1 and sti <= C):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
p = 0
t = 0
for i in range(A-1, max(C, D) - 1):
  if S[i:i+2] == '##':
    p = 1
for j in range(B-1, min(C, D) - 2):  
  if S[j:j+3] == '...':
    t = 1
if S[B] == '.' and S[B-2] == '.':
  t = 1
if (C < D and p == 0) or (C > D and p == 0 and t == 1):
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
def solve():
    N,A,B,C,D = map(lambda x:int(x)-1, input().split())
    field_orig = list(input())
    field = deepcopy(field_orig)

    if C < D:
        if existsContinuousRocks(field,A,B,C,D):
            print('No')
        else:
            print('Yes')
    else:
        if not existsContinuousRocks(field,A,B,C,D) \
            and existsContinuousDots(field,A,B,C,D):
            print('Yes')
        else:
            print('No')

def existsContinuousRocks(field, A, B, C, D):
    for i in range(A, min(max(C,D), len(field)-1)):
        if field[i] == '#' and field[i+1] == '#':
            return True
    return False

def existsContinuousDots(field,A,B,C,D):
    for i in range(B-1,min(D-1, len(field)-2)):
        if field[i] == '.' and field[i+1] == '.' and field[i+2] == '.':
            return True
    return False


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
def solve():
    N,A,B,C,D = map(lambda x:int(x)-1, input().split())
    field_orig = list(input())
    field = deepcopy(field_orig)

    if C < D:
        if existsContinuousRocks(field,A,B,C,D):
            print('No')
        else:
            print('Yes')
    else:
        if not existsContinuousRocks(field,A,B,C,D) \
            and existsContinuousDots(field,A,B,C,D):
            print('Yes')
        else:
            print('No')

def existsContinuousRocks(field, A, B, C, D):
    for i in range(A, min(max(C,D), len(field)-1)):
        if field[i] == '#' and field[i+1] == '#':
            return True
    return False

def existsContinuousDots(field,A,B,C,D):
    for i in range(B,min(D-1, len(field)-2)):
        if field[i] == '.' and field[i+1] == '.' and field[i+2] == '.':
            return True
    return False


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
def solve():
    N,A,B,C,D = map(lambda x:int(x)-1, input().split())
    field_orig = list(input())
    field = deepcopy(field_orig)

    if C < D:
        if existsContinuousRocks(field,A,B,C,D):
            print('No')
        else:
            print('Yes')
    else:
        if not existsContinuousRocks(field,A,B,C,D) \
            and existsContinuousDots(field,A,B,C,D):
            print('Yes')
        else:
            print('No')

def existsContinuousRocks(field, A, B, C, D):
    for i in range(A, min(max(C,D)+1, len(field)-1)):
        if field[i] == '#' and field[i+1] == '#':
            return True
    return False

def existsContinuousDots(field,A,B,C,D):
    for i in range(B,min(D+1, len(field)-2)):
        if field[i] == '.' and field[i+1] == '.' and field[i+2] == '.':
            return True
    return False


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
from copy import deepcopy
def solve():
    N,A,B,C,D = map(lambda x:int(x)-1, input().split())
    field_orig = list(input())
    field = deepcopy(field_orig)

    if C < D:
        if existsContinuousRocks(field,A,B):
            print('No')
        else:
            print('Yes')
    else:
        if not existsContinuousRocks(field,A,B) \
            and existsContinuousDots(field,A,B):
            print('Yes')
        else:
            print('No')

def existsContinuousRocks(field, A, B):
    for i in range(min(A,B),len(field) - 1):
        if field[i] == '#' and field[i+1] == '#':
            return True
    return False

def existsContinuousDots(field, A, B):
    for i in range(max(A,B),len(field) - 2):
        if field[i] == '.' and field[i+1] == '.' and field[i+2] == '.':
            return True
    return False


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

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

Sarr = [True if s == '.' else False for s in S]
#print(Sarr)

def canmove(st):
  global N, Sarr
  can = [False] * N
  can[st-1] = True
  for i in range(st, N):
    if Sarr[i]:
      if can[i-1] or can[i-2]:
        can[i] = True
  return can

Acan = canmove(A)
Bcan = canmove(B)
#print(Acan)
#print(Bcan)

ans = Acan[C-1] and Bcan[D-1]
#print(ans)

def canpass(st, ed):
  global Sarr
  for i in range(st, ed-1):
    if Sarr[i] and Sarr[i+1] and Sarr[i+2]:
      return True
  return False

if C > D:
  ans = ans and canpass(B-1, D)
#print(ans)

if ans:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Sarr = [True if s == '.' else False for s in S]
#print(Sarr)

def canmove(st):
  global N, Sarr
  can = [False] * N
  can[st-1] = True
  for i in range(st, N):
    if Sarr[i]:
      if can[i-1] or can[i-2]:
        can[i] = True
  return can

Acan = canmove(A)
Bcan = canmove(B)
#print(Acan)
#print(Bcan)

ans = Acan[C-1] and Bcan[D-1]
#print(ans)

def canpass(st, ed):
  global Sarr
  for i in range(st, ed-2):
    if Sarr[i] and Sarr[i+1] and Sarr[i+2]:
      return True
  return False

if C > D:
  ans = ans and canpass(B-2, D)
#print(ans)

if ans:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

Sarr = [True if s == '.' else False for s in S]
#print(Sarr)

def canmove(st):
  global N, Sarr
  can = [False] * N
  can[st-1] = True
  for i in range(st, N):
    if Sarr[i]:
      if can[i-1] or can[i-2]:
        can[i] = True
  return can

Acan = canmove(A)
Bcan = canmove(B)
#print(Acan)
#print(Bcan)

ans = Acan[C-1] and Bcan[D-1]
#print(ans)

def canpass(st, ed):
  global Sarr
  for i in range(st, ed-2):
    if Sarr[i] and Sarr[i+1] and Sarr[i+2]:
      return True
  return False

if C > D:
  ans = ans and canpass(B-1, D+1)
#print(ans)

if ans:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

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

long_s = s[a:max(c,d)]
short_s = s[b-2:min(c,d)]
rocks = long_s.count("##")
change = short_s.count("...")

if rocks >= 1:
  print("No")
elif c > d and change == 0:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

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

long_s = s[a:max(c,d)]
short_s = s[b-1:min(c,d)]

rocks = long_s.count("##")
change = short_s.count("...")

if rocks >= 1:
  print("No")
elif c > d and change == 0:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[A:right_end+1]

ans = True
if A < B < C < D:
    if S.count('##'):
        ans = False
elif A < C < B < D:
    if S[A:C+1].count('##') or S[B:D+1].count('##'):
        ans = False
else:
    if S.count('##'):
        ans = False
    elif S[B:D+1].count('...'):
        pass
    elif S[B-1:B+2] == '...':
        pass
    else:
        ans = False

if ans:
    print('Yes')
else:
    print('No')

# print(S)
# print(iwaiwa)
# print(S[B-1:B+2])

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[A:right_end+1]

ans = True
if A < B < C < D:
    if S.count('##'):
        ans = False
elif A < C < B < D:  # 追い越しなし
    if S[A:C+1].count('##') or S[B:D+1].count('##'):
        ans = False
else:
    if S.count('##'):
        ans = False
    elif S[B:D+1].count('...'):
        pass
    elif S[:3] == '...' and B == 1:
        pass
    elif S[-3:] == '...' and D == N-2:
        pass
    else:
        ans = False

if ans:
    print('Yes')
else:
    print('No')

# print(S)
# print(iwaiwa)

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[A:right_end+1]

ans = True
if A < B < C < D:
    if S.count('##'):
        ans = False
elif A < C < B < D:  # 追い越しなし
    if S[A:C+1].count('##') or S[B:D+1].count('##'):
        ans = False
else:
    if S[B:D+1].count('...'):
        pass
    elif S[:3] == '...' and B == 1:
        pass
    elif S[-3:] == '...' and D == N-2:
        pass
    else:
        ans = False

if ans:
    print('Yes')
else:
    print('No')

# print(S)
# print(iwaiwa)

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[A:right_end+1]

ans = True
if A < B < C < D:
    if S.count('##'):
        ans = False
elif A < C < B < D:  # 追い越しなし
    if S[A:C+1].count('##') or S[B:D+1].count('##'):
        ans = False
else:
    if S[B:D+1].count('...'):
        pass
    elif S[:3] == '...' and B == 2:
        pass
    elif S[-3:] == '...' and D == N-2:
        pass
    else:
        ans = False

if ans:
    print('Yes')
else:
    print('No')

# print(S)
# print(iwaiwa)

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[A:right_end+1]

ans = True
if A < B < C < D:
    if S.count('##'):
        ans = False
elif A < C < B < D:  # 追い越しなし
    if S[A:C+1].count('##') or S[B:D+1].count('##'):
        ans = False
else:
    if S[B:D+1].count('...'):
        pass
    elif S[:3] == '...' and B in [1,2]:
        pass
    else:
        ans = False

if ans:
    print('Yes')
else:
    print('No')

# print(S)
# print(iwaiwa)

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[A:right_end+1]

ans = True
if A < B < C < D:
    if S.count('##'):
        ans = False
elif A < C < B < D:  # 追い越しなし
    if S[A:C+1].count('##') or S[B:D+1].count('##'):
        ans = False
else:
    if S[B:D+1].count('...'):
        pass
    elif S[:3] == '...':
        pass
    else:
        ans = False

if ans:
    print('Yes')
else:
    print('No')

# print(S)
# print(iwaiwa)

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[A:right_end+1]

ans = True
if A < B < C < D:
    if S.count('##'):
        ans = False
elif A < C < B < D:  # 追い越しなし
    if S[A:C+1].count('##') or S[B:D+1].count('##'):
        ans = False
else:
    if S[A:D+1].count('...'):
        pass
    else:
        ans = False

if ans:
    print('Yes')
else:
    print('No')

# print(S)
# print(iwaiwa)

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[A:right_end+1]

iwaiwa = S.count('##')
ans = True
if iwaiwa > 0:
    ans = False
else:
    if A < B < C < D or A < C < B < D:  # 追い越しなし
        ans = True
    else:
        space = S.count('...')
        if space > 0:
            ans = True
        else:
            ans = False

if ans:
    print('Yes')
else:
    print('No')

# print(S)
# print(iwaiwa)

Submission status: Wrong Answer

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

A -= 1
B -= 1
C -= 1
D -= 1

right_end = max(C, D)
S = S[:right_end+1]

iwaiwa = S.count('##')
ans = True
if iwaiwa > 0:
    ans = False
else:
    if A < B < C < D or A < C < B < D:  # 追い越しなし
        ans = True
    else:
        space = S.count('...')
        if space > 0:
            ans = True
        else:
            ans = False

if ans:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

flg = '##' in S[A-1:C] or '##' in S[B-1:D]
if C > D and not flg:
  flg = not '...' in S[B-1:D]
print("No" if flg else "Yes")

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = map(int, input().split())
s = input()
ans = 'Yes'
for i in range(1, n):
    if (s[i-1]==s[i]=='#') and (a<i<c or b<i<d):
        ans = 'No'

if c>d:
    if not '...' in s[b:d]:
        ans = 'No'

print(ans)

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = map(int, input().split())
s = input()
ans = 'Yes'
for i in range(1, n):
    if (s[i-1]==s[i]=='#') and (i>=d or i>=c):
        ans = 'No'
        #exit()
if 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 c<d:
    btod=s[b:d]
    atoc=s[a:c]
    if btod.count("##")>0:ans="No"
    if atoc.count("##")>0:ans="No"
else:
    btod=s[b-1-2:d+1]
    atoc=s[a:c]
    if atoc.count("##")>0:ans="No"
    else:
        if btod.count("...")==0:ans="No"
    
print(ans)

Submission status: Wrong Answer

Solution code:
# ???
n,a,b,c,d=map(int,input().split())
s=input()
ans="Yes"

if c<d:
    btod=s[b:d]
    atoc=s[a:c]
    if btod.count("##")>0:ans="No"
    if atoc.count("##")>0:ans="No"
else:
    btod=s[b-1:d+1]
    atoc=s[a:c]
    if atoc.count("##")>0:ans="No"
    else:
        if btod.count("...")==0:ans="No"
    
print(ans)

Submission status: Wrong Answer

Solution code:
# ???
def mi():return map(int,input().split())
n,a,b,c,d=mi()
s=input()

if c<d:
    # print(s[a-1:d+1-1])
    if s[a-1:d+1-1].count("##")>0:
        print("No")
    else:
        print("Yes")
else:
    # print(s[a-1:c+1-1])
    if s[a-1:c+1-1].count("##")>0 or s[b-1:c+1-1].count("...")==0:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
# ???
def mi():return map(int,input().split())
n,a,b,c,d=mi()
s=input()

if c<d:
    # print(s[a-1:d+1-1])
    if s[a-1:d+1-1].count("##")>0:
        print("No")
    else:
        print("Yes")
else:
    # print(s[a-1:c+1-1])
    if s[a-1:c+1-1].count("##")>0 or s[a-1:c+1-1].count("...")==0:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
# ???
def mi():return map(int,input().split())
n,a,b,c,d=mi()
s=input()

if c<d:
    if s[a:d+1].count("##")!=0:
        print("No")
    else:
        print("Yes")
else:
    if s[a:c+1].count("##")!=0 or s[a:c+1].count("...")==0:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,a,b,c,d=map(int,input().split())
s=input()
for i in range(b-1,d-1):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        quit()

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

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,a,b,c,d=map(int,input().split())
s=input()
for i in range(b-1,d-1):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        quit()

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

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,a,b,c,d=map(int,input().split())
s=input()
for i in range(b-1,d-1):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        quit()

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

else:
    flag=0
    for i in range(b-2,c-2):
        # print(s[i],s[i+1],s[i+2])
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            flag=1
    if flag==0:
        print("No")
        quit()
    for i in range(a-1,c-1):
        if s[i]=="#" and s[i+1]=="#":
            print("No")
            quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,a,b,c,d=map(int,input().split())
s=input()
for i in range(b-1,d-1):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        quit()

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

else:
    flag=0
    for i in range(b-1,c-2):
        # print(s[i],s[i+1],s[i+2])
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            flag=1
    if flag==0:
        print("No")
        quit()
    for i in range(a-1,c-1):
        if s[i]=="#" and s[i+1]=="#":
            print("No")
            quit()
print("Yes")

Submission status: Wrong Answer

Solution code:
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
mod=pow(10,9)+7

n,a,b,c,d=map(int,input().split())
s=input()
for i in range(b,d-1):
    if s[i]=="#" and s[i+1]=="#":
        print("No")
        quit()

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

else:
    flag=0
    for i in range(b-1,c-2):
        # print(s[i],s[i+1],s[i+2])
        if s[i]=="." and s[i+1]=="." and s[i+2]==".":
            flag=1
    if flag==0:
        print("No")
        quit()
    for i in range(a,c-1):
        if s[i]=="#" and s[i+1]=="#":
            print("No")
            quit()
print("Yes")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = map(int, input().split())
s = [0 if i == "#" else 1 for i in input()]
if c < d:
    print("Yes")
    exit()
idx = b - 1
cnt = 0
while idx < d:
    if s[idx-1] == s[idx] == s[idx+1] == 1:
        print("Yes")
        exit()
    else:
        idx += 1
print("No")

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    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(a, d-1):
            if s[i:i+2] == "##":
                print("No")
                return 0
        print("Yes")

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

main()

Submission status: Wrong Answer

Solution code:
def main():
    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(a, d-1):
            if s[i:i+2] == "##":
                print("No")
                return 0
        print("Yes")

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

main()