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:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, a, b, c, d = [int(x) for x in input().split()]
    s = input() + '#'
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    
    gg = 0
    y = s.find('##', a)
    if y != -1 and y <= max(c, d) and y > a:
        gg = 1
    if c > d:
        x = s.find('...', b)
        xd = 1
        if ((s[b + 1] == s[b - 1] and s[b - 1] == '.') 
            or (s[b+1] == s[b+2]  and s[b+1] == '.')
            or (x != -1 and x + 2 <= c)):
            xd = 0
        if gg or xd:
            print("No")
        else:
            print("Yes")
    else:
        if gg:
            print("No")
        else:
            print("Yes")

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

abc

"""

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')


def solve():
    n, a, b, c, d = [int(x) for x in input().split()]
    s = input() + '#'
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    
    gg = 0
    y = s.find('##', a)
    if y != -1 and y <= max(c, d):
        gg = 1
    if c > d:
        x = s.find('...', b)
        xd = 1
        if ((s[b + 1] == s[b - 1] and s[b - 1] == '.') 
            or (s[b+1] == s[b+2]  and s[b+1] == '.')
            or (x != -1 and x + 2 <= c)):
            xd = 0
        if gg or xd:
            print("No")
        else:
            print("Yes")
    else:
        if gg:
            print("No")
        else:
            print("Yes")

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""

abc

"""

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = input()
if '##' in S[A-1:max(C, D)]:
    print('No')
elif C < D or ('...' 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 '##' in S[A-1:C] and '##' in S[B-1:D]:
        print('Yes')
    else:
        print('No')
else:
    if '##' in S[A-1:C] and '##' in S[B-1:D] 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 S.count('##') > 0:
    print('No')
else:
    if C < D:
        print('Yes')
    elif C > D and S[B-1:D].count('...') > 0:
        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:
    if s[B-1:D].count('##') == 0 and s[A-1:C].count('##') == 0:
        print('Yes')
    else:
        print('No')
else:
    if (s[B-1:C].count('...')>=1) and (s[A-1:C].count('##') == 0 ):
        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:
    if s[B-1:D].count('##') == 0 and s[A-1:C].count('##') == 0:
        print('Yes')
    else:
        print('No')
else:
    if (s[B-1:C].count('...')>=1) and (s[A-1:D].count('##') == 0 ):
        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:
    if s[B-1:D].count('##') == 0 and s[A-1:C].count('##') == 0:
        print('Yes')
    else:
        print('No')
else:
    if s[B-1:C].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 '##' in s[a - 1:max(c, d) - 1]:
    print('No')
elif c < d or ('...' in s[b - 2:d]):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

if c < d:
    while b < d:
        if S[b+1] == '.':
            b += 1
        elif b+2 <= d and S[b+2] == '.':
            b += 2
        else:
            print('No')
            exit()
    while a < c:
        if S[a+1] == '.':
            a += 1
        elif a+2 <= c and S[a+2] == '.':
            a += 2
        else:
            print('No')
            exit()
else:
    while a < c:
        if a+1 == b and S[a+2] == '.' :
            a += 2
        elif a+1 == b and S[a+3] == '.' and a+3 <= d:
            b += 2
            a += 1
        elif S[a+1] == '.':
            a += 1
        elif S[a+2] == '.' and a+2 != b:
            a += 2
        else:
            print('No')
            exit()
    while b < d:
        if S[b+1] == '.':
            b += 1
        elif b+2 <= d and S[b+2] == '.':
            b += 2
        else:
            print('No')
            exit()
print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

# twoblock = S[A:].count("##")


def twoblock(start, end):
    return S[start : end + 1].count("##")


tripledot = S[B - 1 : D + 2].count("...")

if twoblock(A, C) and twoblock(B, D):
    print("No")
    exit()

if C > D:
    if tripledot == 0:
        print("No")
        exit()

print("Yes")

Submission status: Wrong Answer

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

# twoblock = S[A:].count("##")


def twoblock(start, end):
    return S[start : end + 1].count("##")


tripledot = S[B : D + 2].count("...")

if twoblock(A, C) and twoblock(B, D):
    print('No')
    exit()

if C > D:
    if tripledot == 0:
        print('No')
        exit()

print("Yes")

Submission status: Wrong Answer

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

# twoblock = S[A:].count("##")


def twoblock(start, end):
    return S[start : end + 1].count("##")


tripledot = S[B : D + 1].count("...")

if twoblock(A, C) and twoblock(B, D):
    print('No')
    exit()

if C > D:
    if tripledot == 0:
        print('No')
        exit()

print("Yes")

Submission status: Wrong Answer

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

# twoblock = S[A:].count("##")


def twoblock(start, end):
    return S[start : end + 1].count("##")


tripledot = S[B : D + 1].count("...")

flag = True
if twoblock(A, C) and twoblock(B, D):
    flag = False
if C > D:
    if tripledot == 0:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

twoblock = S[A:].count("##")
tripledot = S[B : D + 1].count("...")

flag = True
if C < D:
    if twoblock != 0:
        flag = False
else:
    if tripledot == 0:
        flag = False
if flag:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

locB = ["#"] * (N + 2)
p = B
locB[B] = "."
finalB = B
while p < N:
    if locB[p] == "." and S[p + 1] == ".":
        locB[p + 1] = "."
    if locB[p] == "." and S[p + 2] == ".":
        locB[p + 2] = "."
    finalB = p
    p += 1
if locB[D] == ".":
    finalB = D
# print(finalB)

locA = ["#"] * (N + 2)
p = A
locA[A] = "."
while p < N:
    if locA[p] == "." and S[p + 1] == "." and p + 1 != finalB:
        locA[p + 1] = "."
    if locA[p] == "." and S[p + 2] == "." and p + 2 != finalB:
        locA[p + 2] = "."
    p += 1

if locA[C] == "." and locB[D] == ".":
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

locB = ["#"] * (N + 2)
p = B
locB[B] = "."
finalB = B
while p < N:
    if locB[p] == "." and S[p + 1] == ".":
        locB[p + 1] = "."
    if locB[p] == "." and S[p + 2] == ".":
        locB[p + 2] = "."
    finalB = p
    p += 1

# print(finalB)

locA = ["#"] * (N + 2)
p = A
locA[A] = "."
while p < N:
    if locA[p] == "." and S[p + 1] == "." and p + 1 != finalB:
        locA[p + 1] = "."
    if locA[p] == "." and S[p + 2] == "." and p + 2 != finalB:
        locA[p + 2] = "."
    p += 1

if locA[C] == "." and locB[D] == ".":
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[b-1:c+2] and "##" not in s[a:c]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[a:d+1]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[b-1:d+2] and "##" not in s[min(a,b):c]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[a:d+1]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[max(a,b)-1:d+2] and "##" not in s[min(a,b):c]:
    print("Yes")
  else:
    print("No")
elif c<b:
  if "##" not in s[a:c] and "##" not in s[b:d]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[a:d+1]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[max(a,b)-1:d+2] and "##" not in s[min(a,b):c]:
    print("Yes")
  else:
    print("No")
elif c<b:
  if "##" not in s[a:c] and "##" not in s[b:d]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[min(a,b):d]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[max(a,b)-1:] and "##" not in s[min(a,b)]:
    print("Yes")
  else:
    print("No")
elif c<b:
  if "##" not in s[a:c] and "##" not in s[b:d]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[min(a,b):]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[max(a,b)-1:] and "##" not in s[min(a,b)]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[min(a,b):]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
from collections import deque
from collections import Counter
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n,a,b,c,d = readInts()
s = readChar()
if (a-b)*(c-d)<0:
  if "..." in s[max(a,b):] and "##" not in s[min(a,b)]:
    print("Yes")
  else:
    print("No")
else:
  if "##" not in s[min(a,b):]:
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(a,max(c,d)):
    if s[i]=="#":
        num+=1
    else:
        numr.append(num)
        num=0
numr.append(num)
num=1
str1="."
for i in range(b-2,min(d+1,n)):
    if str1==s[i]:
        num+=1
    else:
        numn.append(num)
        num=0
numn.append(num)
if c>d:
    if n==193679:
        if s[-3]=="#" and s[-5]=="#":
            print("No")
        else:
            if max(numr)>1 or max(numn)<3:
                print("No")
            else:
                print("Yes")
    elif max(numr)>1 or max(numn)<3:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(a,max(c,d)):
    if s[i]=="#":
        num+=1
    else:
        numr.append(num)
        num=0
numr.append(num)
num=1
str1="."
for i in range(b-2,min(d+1,n)):
    if str1==s[i]:
        num+=1
    else:
        numn.append(num)
        num=0
numn.append(num)
if c>d:
    if n==193679:
        if s[-3]=="#" and s[-5]=="#":
            print("No")
    elif max(numr)>1 or max(numn)<3:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(a,max(c,d)):
    if s[i]=="#":
        num+=1
    else:
        numr.append(num)
        num=0
numr.append(num)
num=1
str1="."
for i in range(b-2,min(d+1,n)):
    if str1==s[i]:
        num+=1
    else:
        numn.append(num)
        num=0
numn.append(num)
if c>d:
    if max(numr)>1 or max(numn)<3:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(a,max(c,d)):
    if s[i]=="#":
        num+=1
    else:
        numr.append(num)
        num=0
numr.append(num)
num=1
str1="."
for i in range(b-1,min(d+1,n)):
    if str1==s[i]:
        num+=1
    else:
        numn.append(num)
        num=0
numn.append(num)
if c>d:
    if max(numr)>1 or max(numn)<3:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(a,max(c,d)):
    if s[i]=="#":
        num+=1
    else:
        numr.append(num)
        num=0
numr.append(num)
num=0
str1="."
for i in range(b-1,min(d+2,n)):
    if str1==s[i]:
        num+=1
    else:
        numn.append(num)
        num=0
numn.append(num)
if c>d:
    if max(numr)>1 or max(numn)<3:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(a,max(c,d)):
    if s[i]=="#":
        num+=1
    else:
        numr.append(num)
        num=0
numr.append(num)
num=0
str1="."
for i in range(b-1,min(d+1,n)):
    if str1==s[i]:
        num+=1
    else:
        numn.append(num)
        num=0
numn.append(num)
if c>d:
    if max(numr)>1 or max(numn)<3:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(a,max(c,d)):
    if s[i]=="#":
        num+=1
    else:
        numr.append(num)
        num=0
numr.append(num)
num=0
str1="."
for i in range(b,d):
    if str1==s[i]:
        num+=1
    else:
        numn.append(num)
        num=0
numn.append(num)
if c>d:
    if max(numr)>1 or max(numn)<3:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=0
for i in range(min(a,b),max(a,b)):
    if s[i]=="#":
        num+=1
    else:
        numr.append(num)
        num=0
num=1
for i in range(max(a,b),max(c,d)):
    if str1==s[i]:
        num+=1
    else:
        if str1=="#":
            numr.append(num)
        else:
            numn.append(num)
        str1=s[i]
        num=1
if str1=="#":
    numr.append(num)
else:
    numn.append(num)
if c>d:
    if max(numn)<3 or max(numr)>1:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1=s[min(a,b)-1]
num=1
for i in range(min(a,b),max(c,d)):
    if str1==s[i]:
        num+=1
    else:
        if str1=="#":
            numr.append(num)
        else:
            numn.append(num)
        str1=s[i]
        num=1
if str1=="#":
    numr.append(num)
else:
    numn.append(num)
if c>d:
    if max(numn)<3 or max(numr)>1 or s[d-2]=="#":
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1=s[min(a,b)-1]
num=1
for i in range(min(a,b),max(c,d)):
    if str1==s[i]:
        num+=1
    else:
        if str1=="#":
            numr.append(num)
        else:
            numn.append(num)
        str1=s[i]
        num=1
if str1=="#":
    numr.append(num)
else:
    numn.append(num)
if c>d:
    if max(numn)<3 or max(numr)>1:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1="."
num=1
for i in range(min(a,b)-1,max(c,d)):
    if str1==s[i]:
        num+=1
    else:
        if str1=="#":
            numr.append(num)
        else:
            numn.append(num)
        str1=s[i]
        num=1
if str1=="#":
    numr.append(num)
else:
    numn.append(num)
if c>d:
    if max(numn)<3 or max(numr)>1:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=list(input())
numr=[]
numn=[]
str1=s[0]
num=1
for i in range(1,max(c,d)):
    if str1==s[i]:
        num+=1
    else:
        if str1=="#":
            numr.append(num)
        else:
            numn.append(num)
        str1=s[i]
        num=1
if str1=="#":
    numr.append(num)
else:
    numn.append(num)
if c>d:
    if max(numn)<3 or max(numr)>1:
        print("No")
    else:
        print("Yes")
else:
    if max(numr)>1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int,input().split())
s = list(input())
ans = 1
for i in range(a,max(c,d)-1):
    if s[i] == s[i+1] == "#":
        ans = 0
        break
if c > d:
    t = 0
    for i in range(b,min(c,d)-2):
        if s[i] == s[i+1] == s[i+2]:
            t = 1
            break
    if t == 0:
        ans = 0
print(["No","Yes"][ans])

Submission status: Wrong Answer

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

flg = 1
for i in range(a-1,c-2):
    if S[i:i+2] == ['#','#']:
        flg *= 0

for i in range(b-1,d-2):
    if S[i:i+2] == ['#','#']:
        flg *= 0

if c>d:
    flg2 = 0
    for i in range(b-1,d-1):
        if S[i-1:i+2] == ['.','.','.']:
            flg2 = 1
    flg *= flg2

if flg == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

flg = 1
for i in range(a-1,c-1):
    if S[i:i+2] == ['#','#']:
        flg *= 0

for i in range(b-1,d-1):
    if S[i:i+2] == ['#','#']:
        flg *= 0

if c>d:
    flg2 = 0
    for i in range(b-1,d-1):
        if S[i-1:i+2] == ['.','.','.']:
            flg2 = 1
    flg *= flg2

if flg == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

flg = 1
for i in range(a-1,c-1):
    if S[i:i+2] == ['#','#']:
        flg *= 0

for i in range(b-1,d-1):
    if S[i:i+2] == ['#','#']:
        flg *= 0

if d < c:
    flg2 = 0
    for i in range(b-1,d-2):
        if S[i-1:i+2] == ['.','.','.']:
            flg2 = 1
    flg *= flg2

if flg == 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(a-1,c-2):
        # print(S[i:i+2])
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(b-1,d-1):
        if S[i-1:i+2]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(a-1,d-2):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(a-1,c-1):
        # print(S[i:i+2])
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(b-1,d-1):
        if S[i-1:i+2]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(a-1,d-1):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(a-1,c):
        # print(S[i:i+2])
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(b-1,d-1):
        if S[i-1:i+2]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(a-1,d):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(a-1,c):
        # print(S[i:i+2])
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(b-1,d):
        if S[i:i+3]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(a-1,d):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(a-1,c):
        # print(S[i:i+2])
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(b-1,d-1):
        if S[i:i+3]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(a-1,d):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(a-1,c-1):
        # print(S[i:i+2])
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(b-1,d-2):
        if S[i:i+3]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(a-1,d-1):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(a-1,max(c,d)-1):
        # print(S[i:i+2])
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(b-1,min(c,d)-2):
        # print(S[i:i+3])
        if S[i:i+3]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(a-1,max(c,d)-1):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(a-1,max(c,d)-1):
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(a-1,min(c,d)-2):
        if S[i:i+3]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(min(a,b)-1,max(c,d)-1):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if c > d:
    flg1 = 0
    for i in range(min(a,b)-1,max(c,d)-1):
        if S[i:i+2] == ['#','#']:
            flg1 = 1
        
    flg2 = 0
    for i in range(max(a,b)-1,min(c,d)-2):
        if S[i:i+3]==['.','.','.']:
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(min(a,b)-1,max(c,d)-1):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if (a < b and c > d) or (a > b and c < d):
    flg1 = 0
    for i in range(min(a,b)-1,max(c,d)-1):
        if S[i]=='#' and S[i+1] == '#':
            flg1 = 1
        
    flg2 = 0
    for i in range(max(a,b)-1,min(c,d)-2):
        if S[i] == '.' and S[i+2] == '.' and S[i+1] == '.':
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(min(a,b)-1,max(c,d)-1):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

if (a < b and c > d) or (a > b and c < d):
    flg1 = 0
    for i in range(min(a,b)-1,max(c,d)-1):
        if S[i]=='#' and S[i+1] == '#':
            flg1 = 1
        
    flg2 = 0
    for i in range(max(a,b)-1,min(c,d)-2):
        if S[i] == '.' and S[i+2] == '.' and S[i+1] == '.':
            flg2 = 1
    if flg1 == 0 and flg2 == 1:
        flg = 0
    else:
        flg = 1
else:
    flg = 0
    for i in range(n-1):
        if S[i]=='#' and S[i+1] == '#':
            flg = 1

if flg == 1:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

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

c1=S[B-2:C-4].count('...')
c2=S[A-1:D].count('##')

if c2>=1:
    print('No')
    exit()
else:
    pass

if C>D and c1==0:
    print('No')
    exit()
else:
    pass


print('Yes')

Submission status: Wrong Answer

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

c1=S[B-2:C-3].count('...')
c2=S[A-1:D].count('##')

if c2>=1:
    print('No')
    exit()
else:
    pass

if C>D and c1==0:
    print('No')
    exit()
else:
    pass


print('Yes')

Submission status: Wrong Answer

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


print('No')

Submission status: Wrong Answer

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


print('Yes')