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:
#Python標準入出力

import numpy as np

# 1行に複数の文字列（数字）を取得，整数に直す
# 今回は2つ受け取って，足し算する

# 0 len root 1 sunuke 2 funuke 3 point1 4 point2 funuke
Masu = list(map(int, input().split()))
Root = input()

N = Masu[0]
A = Masu[1]
B = Masu[2]
C = Masu[3]
D = Masu[4]

S = Root

At = A-1
Bt = B-1
Ct = C-1
Dt = D-1

Judge = True

#Answer 1 パターン入れ込み


threePoints = False

if C < D:
    for j in range(D):
        if Root[j] == "#" and Root[j - 1] == "#":
            Judge = False
            break
else:
    for k in range(C):

        if Root[k] == "#" and Root[k - 1] == "#":
            Judge = False
            break

        if Root[k] == "." and Root[k-1] == "." and Root[k-2] == "." :
            if Dt>k and k > Bt:
                threePoints = True

    Judge = threePoints

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




    # Rock = []
    # for i in range(Masu[0]):
    #     if Root[i] == "#":
    #         Rock.append(i+1)



    # print(threePoints)
    # for j in range(N):
    #     if S[j] == "#" and S[j-1] == "#":
    #         Judge = False
    #
    #     if C == j+1 and D == j+1-1 and Root[j-2] == "#" and threePoints:
    #         Judge = False
    #     if C == j+1 and Root[j-1] == "#" and D == j+1-2 and threePoints:
    #         Judge = False
    #
    #     # if Masu[3] == j+1:
    #     #     for p in range(j):
    #     #         if Masu[4] == p+1 and Root[p-1] == "#":
    #     #             Judge = False




    #Answer 2 動かし

# Sunuke = At
# Funuke = Bt
# throuth = 0
#
#
# if C < D:
#     for i in range(N-Funuke):
#
#         ii = i+Bt
#
#         # print("current {0}: funuke: {1}".format(ii,Funuke))
#         if Funuke == Dt:
#             break
#
#         elif S[ii] == "#" and S[ii+1] == "#":
#             Judge = False
#             break
#
#         elif S[ii] == "#":
#             throuth = 0
#
#         elif S[ii+1] == ".":
#             Funuke = Funuke+1
#
#         elif S[ii+1] == "#":
#             Funuke = Funuke+2
#
#     #
#     # print("Funuke: {}".format(Funuke))
#     # print("Sunuke: {}".format(Sunuke))
#     # print(At)
#     if Judge:
#         for j in range(N-Sunuke):
#
#             jj = j+At
#             # print("current {0}: Sunuke: {1}".format(jj, Sunuke))
#
#             if Sunuke == Ct:
#                 break
#
#             elif S[jj] == "#" and jj + 1 == Funuke:
#                 Judge = False
#                 break
#
#             elif S[jj] == "#":
#                 throuth = 0
#
#             elif S[jj + 1] == ".":
#                 Sunuke = Sunuke + 1
#
#             elif S[jj + 1] == "#" or jj+1 == Funuke:
#                 Sunuke = Sunuke + 2
#
#     #
#     # print(Sunuke)
#     # print(Funuke)
#     #
#
# else:
#     Rock = []
#     for i in range(Masu[0]):
#         if Root[i] == "#":
#             Rock.append(i + 1)
#
#     threePoints = False
#
#     for k in range(N):
#         if k < 1:
#             gg = 0
#         elif S[k] == "." and S[k - 1] == "." and S[k - 2] == ".":
#             # print("roop{}".format(k))
#             if D+1 > k:
#                 threePoints = True
#
#     # print(threePoints)
#
#     for j in range(Masu[0]):
#         if S[j] == "#" and S[j - 1] == "#":
#             Judge = False
#
#         if C == j + 1 and D == j + 1 - 1 and Root[j - 2] == "#" and (not threePoints):
#             Judge = False
#         if C == j + 1 and Root[j - 1] == "#" and D == j + 1 - 2 and (not threePoints):
#             Judge = False
#
#             # if Masu[3] == j+1:
#             #     for p in range(j):
#             #         if Masu[4] == p+1 and Root[p-1] == "#":
#             #             Judge = False
#
# if Judge:
#     print("Yes")
# else:
#     print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int, input().split())
s = input()
index = [(n+1) for n, v in enumerate(s) if s[n:n+3] == "..."]

if s.count("##")>=1:
    print("No")
    exit()

if C < D:
    print("Yes")

if C > D:
    if len(index)>=1:
        for i in index:
            if B <= i+1 <= D:
                print("Yes")
                exit()
        print("No")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
import sys
n, a, b, c, d = map(int, input().split())
s = input()
x = min(a, b, c, d)
y = max(a, b, c, d)


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

else:
    for i in range(y-x-1):
        if s[i+x] == "#" and s[i+x+1] == "#":
            print("No")
            sys.exit()

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

Submission status: Wrong Answer

Solution code:
figure=input()
math=input()

figure=figure.split(' ')
  
for i in range(len(math)-1):
  if math[i]=='#' and math[i+1]=='#':
    print('No')
    exit()

print('Yes')

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int, input().split())
s = input()
index = [(n+1) for n, v in enumerate(s) if s[n:n+3] == "..."]
print(index)

if s.count("##")>=1:
    print("No")
    exit()

elif C < D:
    print("Yes")

elif C > D:
    if len(index)>=1:
        for i in index:
            if B <= i+1 <= D:
                print("Yes")
                exit()
        print("No")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
#Python標準入出力

import numpy as np

# 1行に複数の文字列（数字）を取得，整数に直す
# 今回は2つ受け取って，足し算する

# 0 len root 1 sunuke 2 funuke 3 point1 4 point2 funuke
Masu = list(map(int, input().split()))
Root = input()

N = Masu[0]
A = Masu[1]
B = Masu[2]
C = Masu[3]
D = Masu[4]

S = Root

At = A-1
Bt = B-1
Ct = C-1
Dt = D-1

Judge = True

#Answer 1 パターン入れ込み


threePoints = False

if C < D:
    for j in range(D):
        if Root[j] == "#" and Root[j - 1] == "#":
            Judge = False
            break
else:
    for k in range(D):

        if Root[k] == "#" and Root[k - 1] == "#":
            Judge = False
            break

        if Root[k] == "." and Root[k-1] == "." and Root[k-2] == "." :
            if Dt>k and k > Bt:
                threePoints = True

    Judge = threePoints

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




    # Rock = []
    # for i in range(Masu[0]):
    #     if Root[i] == "#":
    #         Rock.append(i+1)



    # print(threePoints)
    # for j in range(N):
    #     if S[j] == "#" and S[j-1] == "#":
    #         Judge = False
    #
    #     if C == j+1 and D == j+1-1 and Root[j-2] == "#" and threePoints:
    #         Judge = False
    #     if C == j+1 and Root[j-1] == "#" and D == j+1-2 and threePoints:
    #         Judge = False
    #
    #     # if Masu[3] == j+1:
    #     #     for p in range(j):
    #     #         if Masu[4] == p+1 and Root[p-1] == "#":
    #     #             Judge = False




    #Answer 2 動かし

# Sunuke = At
# Funuke = Bt
# throuth = 0
#
#
# if C < D:
#     for i in range(N-Funuke):
#
#         ii = i+Bt
#
#         # print("current {0}: funuke: {1}".format(ii,Funuke))
#         if Funuke == Dt:
#             break
#
#         elif S[ii] == "#" and S[ii+1] == "#":
#             Judge = False
#             break
#
#         elif S[ii] == "#":
#             throuth = 0
#
#         elif S[ii+1] == ".":
#             Funuke = Funuke+1
#
#         elif S[ii+1] == "#":
#             Funuke = Funuke+2
#
#     #
#     # print("Funuke: {}".format(Funuke))
#     # print("Sunuke: {}".format(Sunuke))
#     # print(At)
#     if Judge:
#         for j in range(N-Sunuke):
#
#             jj = j+At
#             # print("current {0}: Sunuke: {1}".format(jj, Sunuke))
#
#             if Sunuke == Ct:
#                 break
#
#             elif S[jj] == "#" and jj + 1 == Funuke:
#                 Judge = False
#                 break
#
#             elif S[jj] == "#":
#                 throuth = 0
#
#             elif S[jj + 1] == ".":
#                 Sunuke = Sunuke + 1
#
#             elif S[jj + 1] == "#" or jj+1 == Funuke:
#                 Sunuke = Sunuke + 2
#
#     #
#     # print(Sunuke)
#     # print(Funuke)
#     #
#
# else:
#     Rock = []
#     for i in range(Masu[0]):
#         if Root[i] == "#":
#             Rock.append(i + 1)
#
#     threePoints = False
#
#     for k in range(N):
#         if k < 1:
#             gg = 0
#         elif S[k] == "." and S[k - 1] == "." and S[k - 2] == ".":
#             # print("roop{}".format(k))
#             if D+1 > k:
#                 threePoints = True
#
#     # print(threePoints)
#
#     for j in range(Masu[0]):
#         if S[j] == "#" and S[j - 1] == "#":
#             Judge = False
#
#         if C == j + 1 and D == j + 1 - 1 and Root[j - 2] == "#" and (not threePoints):
#             Judge = False
#         if C == j + 1 and Root[j - 1] == "#" and D == j + 1 - 2 and (not threePoints):
#             Judge = False
#
#             # if Masu[3] == j+1:
#             #     for p in range(j):
#             #         if Masu[4] == p+1 and Root[p-1] == "#":
#             #             Judge = False
#
# if Judge:
#     print("Yes")
# else:
#     print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int, input().split())
s = input()
index = [(n+1) for n, v in enumerate(s) if s[n:n+3] == "..."]
print(index)

if s.count("##")>=1:
    print("No")
    exit()

if C < D:
    print("Yes")

if C > D:
    if len(index)>=1:
        for i in index:
            if B <= i+1 <= D:
                print("Yes")
                exit()
        print("No")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
n, a, b, c, d = map(int, input().split())
s = input()

if '##' in s[a - 1:c] or '##' in s[b - 1:d]:
    print('No')
else:
    if c < d:
        print('Yes')
    else:
        if '...' in s[b - 1:d]:
            print('Yes')
        else:
            print('No')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
 
import sys
import re
 
_,a,b,c,d = [ int(x)-1 for x in sys.stdin.readline().split() ]
m = sys.stdin.readline().strip()
#
if c>d:
    if m[b-1:d+2].find("...")<0:
        print( "No" )
        exit()
else:
    # b -> d
    if m[b+1:d].find("##")<0:
        print( "No" )
        exit()
    #
    # a -> c
    if m[a+1:c].find("##")<0:
        print( "No" )
        exit()

print( "Yes" )

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int, input().split())
s = input()
index = [(n+1) for n, v in enumerate(s) if s[n:n+3] == "..."]
print(index)

if s.count("##")>=1:
    print("No")
    exit()

if C < D:
    print("Yes")

else:
    if len(index)>=1:
        for i in index:
            if B <= i+1 <= D:
                print("Yes")
                exit()
        print("No")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int,input().split())
S = input()
slist = list(S)
buf = "".join(slist)
#print(N, A, B, C, D)
#print(S)
 
judge = buf.find("##")
#print(judge)
 
#print(slist[A::])
#print(judge)
if judge != -1:
  print("No")
else:
  if C < D:
    print("Yes")
  else:
    s_change= "".join(slist)
    #print(s_change)
    judge = s_change.count("...")
    print(judge)
    if judge > 0:
      print("Yes")
    else:
      print("No")

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

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

a_to_c = s[a-1:c-1]
b_to_d = s[b-1:d-1]
    
possibility = True

if c>d:
    if "##" in a_to_c or "..." not in s[(b-1)-1:d]:
        possibility = False
else:
    if "##" in a_to_c or "##" in s[b-1:d-1]:
        possibility = False

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

Submission status: Wrong Answer

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


if a > b:
    a, b, c, d = b, a, d, c


if '##' in s[a:c] or '##' in s[b:d]:print('No')
else:
    if c < d:
        print('Yes')

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

Submission status: Wrong Answer

Solution code:
def check(start,end,road):
    s = road[start-1:end-1]
    if '##' in s:
        return False
    else:
        return True
 
def check2(start,end,road):
    s = road[start-1:end-1]
    if '...' in s:
        return True
    else:
        return False
 
if __name__ == '__main__':
    n,a,b, c,d = map(int, input().split())
    s = input()
    if c < d:
        if check(a,d,s):
            print('Yes')
        else:
            print('No')
    else:
        if check2(b,d,s):
            if check(a,d,s):
                print('Yes')
            else:
                print('No')
        else:
            print('No')

Submission status: Wrong Answer

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

a_to_c = s[a-1:c-1]
b_to_d = s[b-1:d-1]
    
possibility = True

if c>d:
    if "##" in a_to_c or "..." not in s[(b-1)-1:d-1]:
        possibility = False
else:
    if "##" in a_to_c or "##" in s[b-1:d-1]:
        possibility = False

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

Submission status: Wrong Answer

Solution code:
import sys
n, a, b, c, d = map(int, input().split())
s = input()
x = min(a, b, c, d)
y = max(a, b, c, d)


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

else:
    for i in range(y-x-1):
        if s[i+x] == "#" and s[i+x+1] == "#":
            print("No")
            break

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

Submission status: Wrong Answer

Solution code:
x = input().split()
s = input()
n = int(x[0])
a = int(x[1])
b = int(x[2])
c = int(x[3])
d = int(x[4])
 
 
kome_flag = False # ##がないとTrue
santen_flag = False # ... があればTrue
 
a_s = s[a:c]
b_s = s[b:d]
 
 
if d < c:
  if '...' in s[b-1:d+1]:
    santen_flag = True
kome_flag = True
if '##' in a_s or '##' in b_s:
  kome_flag = False
    
#if not '#' in a_s and not '#' in b_s:
#	print('Yes')
if True:
	if c < d:
		if kome_flag:
			print('Yes')
		else:
			print('No')
 
	if d < c:
		if kome_flag and santen_flag:
			print('Yes')
		else:
			print('No')

Submission status: Wrong Answer

Solution code:
import math
import numpy as np
 
 
def inputs(): return list(map(int, input().split()))
 
 
def main():
    _, A, B, C, D = inputs()
    S = input()
    maxDst = max(C, D)
    courseA = S[A:C]
    courseB = S[B:D]
    cnt = 0
    ans = []
    for i in courseB:
        if i == '#':
            cnt += 1
        else:
            cnt = 0
        if cnt == 2:
            ans.append(False)
            break
    else:
        ans.append(True)
    cnt = 0
    for i in courseA:
        if i == '#':
            cnt += 1
        else:
            cnt = 0
        if cnt == 2:
            ans.append(False)
            break
    else:
        ans.append(True)
    if maxDst == C:
        cnt = 0
        for i in S[B-2:D+1]:
            if i == '.':
                cnt += 1
            if cnt == 3:
                ans.append(True)
                break
        else:
            ans.append(False)
 
    if all(ans):
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)
 
 
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import itertools as it
import collections as col
import heapq
import sys
sys.setrecursionlimit(10**9)

N,A,B,C,D=map(int, input().split())
A-=1
B-=1
C-=1
D-=1
S=list(input())

for i in range(A,C):
    if S[i] == '#' and S[i+1] == '#':   
        print('No')
        exit()

for i in range(B,D):
    if S[i] == '#' and S[i+1] == '#':   
        print('No')
        exit()

if C < D:
    print('Yes')
    exit()

X=[-1]*N
X[B] = 0 if S[B] == '#' else 1
for i in range(B+1,D):
    X[i] = 0 if S[i] == '#' else (X[i-1] + 1)
    if X[i] >= 3:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

Solution code:
from sys import stdin
import numpy as np

N, A, B , C, D = [int(x) for x in stdin.readline().rstrip().split()]
S = input().strip().translate(str.maketrans({'#': '1', '.': '0'}))
ss = [int(c) for c in S ]

ans = ''

# 連続して岩があるとき（＝解けない）
for i in range(N - 1):       
    if ss[i] == 1  and ss[i+1] == 1 :
        ans = 'No'
    else :
        ans = 'Yes'

# 場合分けして解く
if D > C:
    ans = ans

elif D < C:
    # 3マス連続する空きマスがあれば順番をいれかえられる
    if ans == 'Yes':
        ans = 'No'
        for i in range(D - B - 1):
            i = i + B
            if ss[i-1] == 0 and ss[i] == 0 and ss[i+1] == 0 :
                ans = 'Yes'
else :
    ans = 'No'

print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
rocks = []
flag = True
for i, s in enumerate(S):
    if s == '#':
        rocks.append(i+1)
if 1 in [rocks[i+1] - rocks[i] for i in range(len(rocks) - 1)]:
    flag = False
if flag:
    if C > D:
        for i in range(B, D+1):
            if i - 1 in rocks or i in rocks or i+1 in rocks:
                flag = False
if flag:
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

# if '##' in S[A:max(C, D)]:
#     print('No')
if C<D:
    print('Yes')
else:
    if '...' 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()[:max(c,d)]

def main():
    if "##" in s[b:d]:
        return "No"
    if "##" in s[c:c]:
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d+1]:
            return "Yes"
                
        return "No"

print(main())

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int, input().split())
s=input()
v=0
x=0
for i in range(n-2):
    if c<d:
        if i>b and i<d and s[i]=='#' and s[i+1]=='#':
            print('No')
            v+=1
            break

    
    elif c>d:
        if  i>=b-1 and i<d+1 and s[i]=='.' and  s[i+1]=='.' and s[i+2]=='.' :
            x=1
            break
if x==0:
    print('No')
            
if x==1:
    for i in range(n-2):
        if i>b and i<c and s[i]=='#' and s[i+1]=='#':
            print('No')
            v+=1
            break
    if v==0:
        print('Yes')
if c<d and v==0:
    print('Yes')

Submission status: Wrong Answer

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

a_to_c = s[a-1:c-1]
b_to_d = s[b-1:d-1]
    
possibility = True

if c>d:
    if "##" in a_to_c or "..." not in b_to_d:
        possibility = False
else:
    if "##" in a_to_c or "##" in b_to_d:
        possibility = False

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

Submission status: Wrong Answer

Solution code:
x = input().split()
s = input()
n = int(x[0])
a = int(x[1])
b = int(x[2])
c = int(x[3])
d = int(x[4])
 
 
kome_flag = False # ##がないとTrue
santen_flag = False # ... があればTrue
 
a_s = s[a:c]
b_s = s[b:d]
 
 
if d < c:
  print('Yes')
else:
  print('No')

Submission status: Wrong Answer

Solution code:
import sys

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
x = input().split()
s = input()
n = int(x[0])
a = int(x[1])
b = int(x[2])
c = int(x[3])
d = int(x[4])
 
 
kome_flag = False # ##がないとTrue
santen_flag = False # ... があればTrue
 
a_s = s[a:c]
b_s = s[b:d]
 
if c < d:
  print('Yes')

Submission status: Wrong Answer

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

def main():
    if "##" in s[b:d]:
        return "No"
    if "##" in s[c:c]:
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d]:
            return "Yes"
                
        return "No"

print(main())

Submission status: Wrong Answer

Solution code:
import itertools as it
import collections as col
import heapq
import sys
sys.setrecursionlimit(10**9)

N,A,B,C,D=map(int, input().split())
A-=1
B-=1
C-=1
D-=1
S=list(input())

for i in range(A,C):
    if S[i] == '#' and S[i+1] == '#':   
        print('No')
        exit()

for i in range(B,D):
    if S[i] == '#' and S[i+1] == '#':   
        print('No')
        exit()

if C < D:
    print('Yes')
    exit()

X=[-1]*N
X[A] = 0 if S[A] == '#' else 1
for i in range(A+1,D):
    X[i] = 0 if S[i] == '#' else (X[i-1] + 1)
    if X[i] >= 3:
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

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

def max_stone(a, b):
  m = 0
  for j in range(a, b-1):
    if S[j] == S[j+1] == '#':
      return False
  
  return True
  
def reachable(b, d):
  n_sharp = 0
  n_dot = 0
  for j in range(b-1, d+1):
    s = S[j]
    if s=='.':
      n_dot += 1
      n_sharp = 0
    else:
      n_sharp += 1
      n_dot = 0
      
    if n_dot == 3:
      return True
    
  return False

def reachable2(b, d):
  for k in range(b-1,d):
    if S[k] == S[k+1] == S[k+2] == ".":
      return True
  return False
  
if C < B:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C < D:
  if max_stone(A-1, C) and max_stone(B-1, D):
    print('Yes')
  else:
    print('No')
elif B < C and C > D:
  if reachable(B-1, D-1) and max_stone(A-1, C) and max_stone(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()
slist = list(S)
buf = "".join(slist[A:max(C,D)-1])
#print(N, A, B, C, D)
#print(S)
 
judge = buf.find("##")
#print(judge)
 
#print(slist[A::])
#print(judge)
if judge != -1:
  print("No")
else:
  if C < D:
    print("Yes")
  else:
    s_change= "".join(slist[A:C-1])
    #print(s_change)
    judge = s_change.count("...")
    #print(judge)
    if judge > 0:
      print("Yes")
    else:
      print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int, input().split())
s = input()
index = [(n+1) for n, v in enumerate(s) if s[n:n+3] == "..."]

if s.count("##")>=1:
    print("No")
    exit()

if C < D:
    print("Yes")

elif C > D:
    if len(index)>=1:
        for i in index:
            if B <= i+1 <= D:
                print("Yes")
                exit()
        print("No")
    else:
        print("No")

Submission status: Wrong Answer

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

def main():
    if "##" in s[b:d-2]:
        return "No"
    if "##" in s[c:c-2]:
        return "No"

    if c < d:
        return "Yes"
    
    else:

        if "..." in s[b-2:d-1]:
            return "Yes"
                
        return "No"

print(main())

Submission status: Wrong Answer

Solution code:
x = input().split()
s = input()
n = int(x[0])
a = int(x[1])
b = int(x[2])
c = int(x[3])
d = int(x[4])

print(d)
 
kome_flag = False # ##がないとTrue
santen_flag = False # ... があればTrue
 
a_s = s[a:c]
b_s = s[b:d]
 
 
if d < c:
  if '...' in s[b-1:d]:
    santen_flag = True
    
kome_flag = True
if '##' in a_s or '##' in b_s:
  kome_flag = False
    
#if not '#' in a_s and not '#' in b_s:
#	print('Yes')
if True:
	if c < d:
		if kome_flag:
			print('Yes')
		else:
			print('No')
 
	if d < c:
		if kome_flag and santen_flag:
			print('Yes')
		else:
			print('No')

Submission status: Wrong Answer

Solution code:
#Python標準入出力

import numpy as np

# 1行に複数の文字列（数字）を取得，整数に直す
# 今回は2つ受け取って，足し算する

# 0 len root 1 sunuke 2 funuke 3 point1 4 point2 funuke
Masu = list(map(int, input().split()))
Root = input()

N = Masu[0]
A = Masu[1]
B = Masu[2]
C = Masu[3]
D = Masu[4]

S = Root

At = A-1
Bt = B-1
Ct = C-1
Dt = D-1

Judge = True

#Answer 1 パターン入れ込み

# Rock = []
# for i in range(Masu[0]):
#     if Root[i] == "#":
#         Rock.append(i+1)


threePoints = False

if C < D:
    for j in range(N):
        if Root[j] == "#" and Root[j - 1] == "#":
            Judge = False
            break
else:
    for k in range(N):

        if Root[k] == "#" and Root[k - 1] == "#":
            Judge = False
            break

        if Root[k] == "." and Root[k-1] == "." and Root[k-2] == "." :
            if Dt>k and k > Bt:
                threePoints = True

    Judge = threePoints
# print(threePoints)

# for j in range(N):
#     if S[j] == "#" and S[j-1] == "#":
#         Judge = False
#
#     if C == j+1 and D == j+1-1 and Root[j-2] == "#" and threePoints:
#         Judge = False
#     if C == j+1 and Root[j-1] == "#" and D == j+1-2 and threePoints:
#         Judge = False
#
#     # if Masu[3] == j+1:
#     #     for p in range(j):
#     #         if Masu[4] == p+1 and Root[p-1] == "#":
#     #             Judge = False

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









#Answer 2 動かし

# Sunuke = At
# Funuke = Bt
# throuth = 0
#
#
# if C < D:
#     for i in range(N-Funuke):
#
#         ii = i+Bt
#
#         # print("current {0}: funuke: {1}".format(ii,Funuke))
#         if Funuke == Dt:
#             break
#
#         elif S[ii] == "#" and S[ii+1] == "#":
#             Judge = False
#             break
#
#         elif S[ii] == "#":
#             throuth = 0
#
#         elif S[ii+1] == ".":
#             Funuke = Funuke+1
#
#         elif S[ii+1] == "#":
#             Funuke = Funuke+2
#
#     #
#     # print("Funuke: {}".format(Funuke))
#     # print("Sunuke: {}".format(Sunuke))
#     # print(At)
#     if Judge:
#         for j in range(N-Sunuke):
#
#             jj = j+At
#             # print("current {0}: Sunuke: {1}".format(jj, Sunuke))
#
#             if Sunuke == Ct:
#                 break
#
#             elif S[jj] == "#" and jj + 1 == Funuke:
#                 Judge = False
#                 break
#
#             elif S[jj] == "#":
#                 throuth = 0
#
#             elif S[jj + 1] == ".":
#                 Sunuke = Sunuke + 1
#
#             elif S[jj + 1] == "#" or jj+1 == Funuke:
#                 Sunuke = Sunuke + 2
#
#     #
#     # print(Sunuke)
#     # print(Funuke)
#     #
#
# else:
#     Rock = []
#     for i in range(Masu[0]):
#         if Root[i] == "#":
#             Rock.append(i + 1)
#
#     threePoints = False
#
#     for k in range(N):
#         if k < 1:
#             gg = 0
#         elif S[k] == "." and S[k - 1] == "." and S[k - 2] == ".":
#             # print("roop{}".format(k))
#             if D+1 > k:
#                 threePoints = True
#
#     # print(threePoints)
#
#     for j in range(Masu[0]):
#         if S[j] == "#" and S[j - 1] == "#":
#             Judge = False
#
#         if C == j + 1 and D == j + 1 - 1 and Root[j - 2] == "#" and (not threePoints):
#             Judge = False
#         if C == j + 1 and Root[j - 1] == "#" and D == j + 1 - 2 and (not threePoints):
#             Judge = False
#
#             # if Masu[3] == j+1:
#             #     for p in range(j):
#             #         if Masu[4] == p+1 and Root[p-1] == "#":
#             #             Judge = False
#
# if Judge:
#     print("Yes")
# else:
#     print("No")

Submission status: Wrong Answer

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

n, a, b, c, d = map(int, input().split())
s = input()
if '##' not in s:
    ans = 'Yes'
    if c > d:
        if '...' in s[:d]:
            ans = 'Yes'
        elif '.' in s[d-2] and '.' in s[d]:
            ans = 'Yes'
        else:
            ans = 'No'
else:
    ans = 'No' 
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int,input().split())
S = input()
slist = list(S)
buf = "".join(slist[A:max(C,D)-1])
#print(N, A, B, C, D)
#print(S)

judge = buf.find("##")
#print(judge)

#print(slist[A::])
#print(judge)
if judge != -1:
  print("No")
else:
  if C < D:
    print("Yes")
  else:
    s_change= "".join(slist[A:C-1])
    print(s_change)
    judge = s_change.count("...")
    print(judge)
    if judge > 0:
      print("Yes")
    else:
      print("No")