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

Solution (Python):



















import sys
input=sys.stdin.readline
inf=float('inf')
mod = 10**9+7
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [input() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N, A, B, C, D = MI()
    S = "."+ST()
    for i in range(min(A, B), max(C, D) ):
        if S[i] == "
            print("No")
            exit()
    
    if (A - B) * (C - D) >= 0:
        print("Yes")
    else:
        
        for i in range(max(A, B) + 1, min(N,min(C, D) + 2)):
            if S[i] == "." and S[i - 1] == "." and S[i - 2] == ".":
                print("Yes")
                exit()
        print("No")

if __name__ == '__main__':
    main()

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

S=input()

if C<D:
    for i in range(B, D-1):
        if S[i]=='
            print("No")
            exit(0)
    for i in range(A, B-1):
        if S[i]=='
            print("No")
            exit(0)
    print("Yes")
else:
    flag=False
    for i in range(B-1, D):
        if S[i]=='
            print("No")
            exit(0)
        if S[i]=='.' and S[i+1]=='.' and S[i+2]=='.':
            flag=True
    for i in range(A, C-1):
        if S[i]=='
            print("No")
            exit(0)
    print("Yes" if flag else "No")

Solution (Python):
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
Max = sys.maxsize
def l():
	return list(map(int,input().split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[0]
	su = 1
	for i in range(len(x)-1):
		if aa != x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a
def jo(x):
	return " ".join(map(str,x))

n,a,b,c,d = m();
ss = list(input())
if c < d:
	k = s(ss[b-1:d])
	for i in range(len(k)):
		if k[i][0] == "
			print("No")
			exit()
	k = s(ss[a-1:c])
	for i in range(len(k)):
		if k[i][0] == "
			print("No")
			exit()
	print("Yes")
	exit()
else:
	
	count = 0
	k = s(ss[b-2:d])
	for i in range(len(k)):
		if k[i][0] == "
			print("No")
			exit()
		if k[i][0] == "." and k[i][1] >= 3:
			count = 1
	if count == 1:
		k = s(ss[a-1:c])
		for i in range(len(k)):
			if k[i][0] == "
				print("No")
				exit()
		print("Yes")
		exit()
	else:
		ss[d-1] = "
		k = s(ss[a-1:c])
		for i in range(len(k)):
			if k[i][0] == "
				print("No")
				exit()
		print("Yes")
		exit()

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

import sys
if B > C:
    isi = 0
    cnt = 0
    for j in range(A-1,C):
        i = S[j]
        if i == '.':
            cnt = 0
        elif i == '
            cnt += 1
            isi = max(isi,cnt)
    cnt = 0
    for j in range(B-1,D):
        i = S[j]
        if i == '.':
            cnt = 0
        elif i == '
            cnt += 1
            isi = max(isi,cnt)
    if isi <= 1:
        print('Yes')
    else:
        print('No')
    sys.exit()


aki = 0
isi = 0
cnt = 0
for j in range(min(A,B)-1,max(C,D)):
    i = S[j]
    if i == '.':
        cnt = 0
    elif i == '
        cnt += 1
        isi = max(isi,cnt)
        
cnt = 0
for j in range(B-2,min(D+1,N)):
    i = S[j]
    if i == '
        cnt = 0
    elif i == '.':
        cnt += 1
        aki = max(aki,cnt)
        

if C > D:
    if aki >= 3 and isi <= 1:
        print('Yes')
    else:
        print('No')
else:
    if isi <= 1:
        print('Yes')
    else:
        print('No')

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

a = A - 1
b = B - 1
c = C - 1
d = D - 1
n = N - 1

is_able = False

while True:
  if a != c and (a+1) <= n and S[a+1] == "." and (a+1) != b:
    a += 1
  elif a != c and (a+2) <= n and S[a+2] == "." and (a+2) != b:
    a += 2
  elif b != d and (b+1) <= n and S[b+1] == "." and (b+1) != a:
    b += 1
  elif b != d and (b+2) <= n and S[b+2] == "." and (b+2) != a:
    b += 2
  else:
    is_able = False
    break
    
  if a == c and b == d:
    is_able = True
    break
    
if is_able:
  print("Yes")
else:
  print("No")

Solution (Python):
import sys
sys.setrecursionlimit(100000)

def intinput(): return map(int,input().split())

def x(s):
    try:
        s.index("
    except:
        return True
    else:
        return False

n,a,b,c,d=intinput()
s=input()
if c<d:
    if x(s[a-1:d]):
        print("Yes")
    else:
        print("No")
else:
    try:
        s[b-2:d+1].index("...")
    except:
        print("No")
    else:
        if x(s[a - 1:c]):
            print("Yes")
        else:
            print("No")

Solution (Python):
n,a,b,c,d = map(int,input().split())
s = list(input())
n = n-(a-1)
b = b-(a-1)-1
c = c-(a-1)-1
d = d-(a-1)-1
for i in range(a-1):
    s.pop(0)
a = a-(a-1)-1
for i in range(n-(max(c,d)+1)):
    s.pop(-1)
n -= n-(max(c,d)+1)

check = True
for i in range(n-1):
    if s[i] == "
        check = False

temp = False
for i in range(b,d+1):
    if i+1 < n:
        if s[i] == "." and s[i-1] == "." and s[i+1] == ".":
            temp = True
            break
    else:
        temp = True


if check == False:
    print("No")
else:
    if temp:
        print("Yes")
    else:
        print("No")

Solution (Python):



def f(S, N, A, B, C, D):
    if B > C:
        if g(S, A, C) or g(S, C, D):
            return 'No'
        else:
            return 'Yes'
            
    elif C < D:
        if g(S, A, D):
            return 'No'
        else:
            return 'Yes'
        
    else:
        if g(S, A, B):
            return 'No'

        if g2(S, B-1, D):
            return 'Yes'
        
        return 'No'


def g(S, X, Y):
    for i in range(X-1, Y-1):
        if S[i] == '
            return True

    return False



def g2(S, X, Y):
    for i in range(X-1, Y-1):
        if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
            return True

    return False



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

    print(f(S, N, A, B, C, D))
 


if __name__ == '__main__':
    main()

Solution (Python):
N,A,B,C,D =map(int,input().split())
S = input()[min(A,B):max(C,D) + 1]

if C < D:
  if not "
    print("Yes")
  else:
    print("No")
else:
  if not "
    if "..." in S[B - 3:D]:
      print("Yes")
    else:
      print("No")
  else:
    print("No")

Solution (Python):
def inpl(): return list(map(int, input().split()))

N, A, B, C, D = inpl()
S = input()

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

A, B, C, D = A-1, B-1, C-1, D-1
if C < D:
    if ("
        print("No")
    else:
        print("Yes")

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

Solution (Python):
import sys
n, a, b, c, d = map(int,input().split())
s = input()
judgesharp = False
judgepass = False
threepoint = 0
count = 0
a -= 1
b -= 1
c -= 1
d -= 1
if c < d:
  for i in s:
    if count < a or count > d:
      pass
    elif i == "
      if judgesharp == True:
        print("No")
        sys.exit()
      else:
        judgesharp = True
    else:
      judgesharp = False
    count += 1
  print("Yes")
else:
  for i in s:
    if count < a or count > c:
      pass
    elif i == "
      threepoint = 0
      if judgesharp == True:
        print("No")
        sys.exit()
      else:
        judgesharp = True
    else:
      if b-1 <= count and count <= d+1:
        threepoint += 1
      judgesharp = False
    if threepoint == 3:
      judgepass = True
    count += 1
  if judgepass:
    print("Yes")
  else:
    print("No")

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

def judge(start,goal):
    for i in range(start,goal-1):
        if s[i] == "
            return 0
    return 1

def full_judge (start,obst,obfin,goal):
    if s[obst-2] == "." and s[obst] == "." :
        return 1
    for i in range(obst-1,obfin-1):
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            return 1
    return 0


if c<b:
    if (judge(a,c) and judge(b,d)):
        print("Yes")
    else:
        print("No")
elif c<d:
    if (judge(a,c) and judge(b,d)):
        print("Yes")
    else:
        print("No")
else:
    if judge(b,d) and full_judge(a,b,d,c) and judge(a,c):
        print("Yes")
    else:
        print("No")

Solution (Python):
import sys
from collections import deque
from collections import defaultdict
import math
sys.setrecursionlimit(20000000)

 
n,a,b,c,d = map(int,input().split())
a-=1;b-=1;c-=1;d-=1
s = input()
if (a < b and c<d):
        if  "
                print("No")
                exit()
        if   "
                print("No")
                exit()
        print("Yes")
else:
        if  "
                print("No")
                exit()
        if   "
                print("No")
                exit()
        if  "..." in s[b-1:d+2]:
                print("Yes")
                exit()
        print("No")

Solution (Python):
import numpy as np
from collections import defaultdict
from functools import reduce




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

if '...' in s2[(b-1):(d+1)] and not ('
    print('Yes')
    exit()


if all(s[i] == '.' or s[i+1] == '.' for i in range(b,d)):
    s[d] = '
    if all(s[i] == '.' or s[i+1] == '.' for i in range(a,c)):
        print('Yes')
        exit()

print('No')

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

rock=0
blank=0
for i in range(a,c):
    if path[i-1]=='
        rock=1
for i in range(b,d):
    if path[i-1]=='
        rock=1

for i in range(max(a,b),min(c,d)+1):
    if path[i-2]=='.' and path[i-1]=='.' and path[i]=='.':
        blank=1

if rock==0 and ((a-b)*(c-d)>0 or (blank==1 and (a-b)*(c-d)<0)):
    print('Yes')
else:
    print('No')

Solution (Python):
import sys
input = sys.stdin.readline
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18
MOD=10**9+7

N,A,B,C,D=rl()
S=input()
M=[0]*(N+1)
for i in range(N):
    M[i] = 0 if S[i]=='.' else 1

ans = 1

flag_2 = 0
cnt = 0
for i in range(A-1,D):
    if M[i] == 1:
        cnt += 1
    else:
        cnt = 0
    if cnt >= 2:
        flag_2 = 1
        break
if flag_2==1:
    ans = 0

flag_3 = 0
cnt = 0
if C > D:
    for i in range(B-2,D+1):
        if M[i] == 0:
            cnt += 1
        else:
            cnt = 0
        if cnt>=3:
            flag_3 = 1
            break
    if flag_3 == 0:
        ans = 0

yn(ans)

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

if C < D:
    lst = []
    for i in range(N-1):
        if S[i] == '
            if (A-1 <= i and i <= C-1) or (B-1 <= i and i <= D-1):
                print ('No')
                sys.exit()
    print ('Yes')
    sys.exit()
        
if C > D:
    flag1 = False
    lst = []
    for i in range(1,N-1): 
        if S[i] == '
            if (A-1 <= i and i <= C-1) or (B-1 <= i and i <= D-1):
                print ('No')
                sys.exit()
        if S[i-1] == '.' and S[i] == '.' and S[i+1] == '.' and B-1 <= i and i <= D-1: 
            flag1 = True


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

Solution (Python):
n,a,b,c,d=map(int,input().split())
a-=1
b-=1
c-=1
d-=1
s=input()
m=[0 for i in range(n)]



for i in range(n):
  if s[i]=="
    m[i]=1
if c<d:
  if "
    print("No")
  else:
    print("Yes")
else:
  if "
    print("No")
  else:
    if "..." in s[b-1:d+2]:
      print("Yes")
    else:
      print("No")

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

c_swap = True 

if C > D:
    
    if "..." in S[B-2:min(C, D+1)]:
        reset = S.find("...") + 1
        A = reset + 1
        B = reset + 2
    else:
        c_swap = False
    

is_f_ok = "


is_s_ok = "

print("Yes") if (is_f_ok & is_s_ok & c_swap) else print("No")

Solution (Python):

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


if ("
    print("No")
elif not("
    print("Yes")
else:
    if s[b-1] == "." and s[b+1] == ".":
        print("Yes")
    elif "..." in s[b:d+1] or (s[d-1] == "." and s[d+1] == "."):
        print("Yes")
    else:
        print("No")

Solution (Python):
N,A,B,C,D = map(int, raw_input().split())
S = raw_input()
i = 1
flagskip = 0
flagskip2 = 0
flagerror = 0
flags = 0
flagstop = 0
flagstop2 = 0
for c in S:
	if(flagstop2 == 1):
		if(c =='
			flagstop += 1
		flagstop2 = 0
	if(i <= A):
		i += 1
		continue
	elif(i == B or (i == D and D < C)):
		if(flags == 1):
			flagstop += 1
		else:
			flagstop2 = 1
	if(c == '
		if(flags == 1):
			flagerror = 1
			break
		flags = 1
		flagskip2 = 0
	else:
		if(flagskip2 == 1):
			flagskip = 1
		elif(flags == 0 and flagskip == 0 and i > B-1 and i < D+1):
			flagskip2 = 1
		flags = 0
	if(i == max(C,D)):
		break
	i += 1
if(flagstop == 2 and flagskip == 0):
	flagerror = 1
if(flagerror == 0):
	print("Yes")
else:
	print("No")

Solution (Python):
import sys
INPUT = sys.stdin.readline

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

N, A, B , A_goal, B_goal = MULTIPLE_INT_MAP()
S = SINGLE_STRING()

def surpass():

    if '...' in S[B-2:B_goal+1]:
        return 'Yes'
    else:
        return 'No'


if '
    print('No')

else:
    if A_goal < B_goal:
        print('Yes')
    else:
        print(surpass())

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

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

for i in range(B,D):
    if S[i] == "
        print("No")
        exit()

for i in range(A,C):
    if S[i] == "
        print("No")
        exit()

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

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

Solution (Python):
N, A, B, C, D = list(map(int, input().split()))
S = input()
X = [".", "
Ans = ["Yes", "No"]

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

f = 0
if A < B:
  if B < C and D < C:
    f = 1

a, b = A, C
s = 0
for i in range(a, b + 1):
  if S[i] == X[1]:
    if s == 1:
      print(Ans[1])
      exit()
    s = 1
  else:
    s = 0

a, b = B, D
s = 0
for i in range(a, b + 1):
  if S[i] == X[1]:
    if s == 1:
      print(Ans[1])
      exit()
    s = 1
  else:
    s = 0

if f == 0:
  print(Ans[0])
  exit()

s = 0
for i in range(B - 1, min(D + 2, N)):
  if S[i] == X[1]:
    if s == 1:
      break
    else:
      s = 1
  else:
    if s == 1:
      s = -1
    else:
      s -= 1
      if s == -3:
        print(Ans[0])
        exit()

print(Ans[1])

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

s = input()

for i in range(A + 1, C - 2 + 1):
    if s[i] == '
        print('No')
        exit()
for i in range(B + 1, D - 2 + 1):
    if s[i] == '
        print('No')
        exit()

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

Solution (Python):
import sys,collections,math,random;sys.setrecursionlimit(10**7)
def Is(): return [int(x) for x in sys.stdin.readline().split()]
def Ss(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,A,B,C,D = Is()
s = S()
if "
    print("No")
elif C < D:
    print("Yes")
elif C > D:
    if "..." in s[B-2:D+1]:
        print("Yes")
    else:
        print("No")

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

S = [1] + [ 1 if x == "

S[A] = 2
S[B] = 3


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

enable = True

for i in range(min(A, B)+1, max(C, D)-1):
    if S[i] == S[i+1] == 1:
        enable = False
        break

if A < B < D < C:
    vcnt = 0
    for i in range(B-1, D+1+1):
        if S[i] != 1:
            vcnt += 1
            if vcnt >= 3:
                break
        else:
            vcnt = 0
    else:
        enable = False

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

Solution (Python):
n,a,b,c,d=map(lambda x: int(x)-1,input().split())
n+=1
s=input()

def check(x,y,s): 
    if '
        return False
    return True

def solve():
    if c<d:
        return check(a,c,s) and check(b,d,s)
    t=list(s)
    t[b]='
    t=''.join(t)
    if check(a,c,t):
        return check(b,d,s)
    if c>d+1:
        if '...' in s[b:d+2]:
            return check(a,b,s)
    else:
        if '...' in s[b:d+1]:
            return check(a,b,s)
    
print('Yes' if solve() else 'No')

Solution (Python):


import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N,A,B,C,D=MAP()
S='

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

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

flag = 0

if D > C:
    for i in range(D-B-2):
        if S[B+i] == '
            print('No')
            flag = 1
            break
    if flag == 0:
        for j in range(C-A-2):
            if S[A+j] == '
                print('No')
                flag = 1
                break        
        if flag == 0:
            print('Yes')
else:
    count = 0
    for i in range(D-B+3):
        if S[B-2+i] == '.':
            count += 1
        else:
            count = 0
        if count == 3:
            flag = 1
            break
    if flag == 0:
        print('No')
    else:
        for j in range(C-A-2):
            if S[A+j] == '
                print('No')
                flag = 0
                break        
        if flag == 1:
            print('Yes')

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

lbound = min(a, b) - 1

if "
    print("No")
elif ((a > b) ^ (c > d)) and "..." not in s[max(a, b) - 2 : min(c, d) + 1]:
    print("No")
else:
    print("Yes")

Solution (Python):
def getlist():
	return map(int, input().split())

N, A, B, C, D = getlist()
S = list(input())

a = A - 1
b = B - 1
c = C - 1
d = D - 1

if c < b:
	judge1 = "YES"
	j = 0
	val = 0
	for i in range(a, c):
		if S[i] == ".":
			val = 0
		else:
			val += 1
			if val > j:
				j = val
	if j >= 2:
		judge1 = "NO"

	judge2 = "YES"
	j = 0
	val = 0
	for i in range(b, d):
		if S[i] == ".":
			val = 0
		else:
			val += 1
			if val > j:
				j = val
	if j >= 2:
		judge2 = "NO"

	if judge1 == "YES" and judge2 == "YES":
		print("Yes")
	else:
		print("No")


elif c < d:
	judge = "Yes"
	j = 0
	val = 0
	for i in range(a, d):
		if S[i] == ".":
			val = 0
		else:
			val += 1
			if val > j:
				j = val
	if j >= 2:
		judge = "No"
	print(judge)

else:
	judge1 = "YES"
	j = 0
	val = 0
	for i in range(a, c):
		if S[i] == ".":
			val = 0
		else:
			val += 1
			if val > j:
				j = val
	if j >= 2:
		judge1 = "NO"

	judge2 = "YES"
	j = 0
	val = 0
	for i in range(b - 1, d + 2):
		if S[i] == "
			val = 0
		else:
			val += 1
			if val > j:
				j = val
	if j <= 2:
		judge2 = "NO"

	if judge1 == "YES" and judge2 == "YES":
		print("Yes")
	else:
		print("No")

Solution (Python):
import bisect
from operator import itemgetter
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N,sunke,hunke,Gs,Gh = IL()
s = S()

f = 0
for i in range(sunke-1,max(Gs,Gh)):
    if f == 0:
        if s[i]=="
            f = 1
    else:
        if s[i]=="
            print("No")
            exit()
        else:
            f = 0

cnt = 0
cntf = 0
for i in range(hunke-2,min(Gs,Gh)+1):
    if s[i]=="
        cnt = 0
    else:
        cnt += 1
    if cnt == 3:
        cntf = 1
        break

if (sunke < hunke) and (Gs > Gh):
    if cntf == 1:
        print("Yes")
    else:
        print("No")
else:
    print("Yes")

Solution (Python):


import math

def main():
    n,a,b,c,d = map(int, raw_input().split())
    s = list(raw_input())
    chk = True
    cnt = 1
    hurdleA = 0
    hurdleB = 0
    three = 0
    threeChk = False
    for i in s:
        if cnt >= b-1 and cnt <= d+1:
            if i == '.':
                three += 1
            else:
                three = 0
            if three >= 3:
                threeChk = True
        if cnt > a and cnt < c:
            if i == '
                hurdleA += 1
            else:
                hurdleA = 0
            if hurdleA >= 2:
                chk = False
                break
        if cnt > b and cnt < d:
            if i == '
                hurdleB += 1
            else:
                hurdleB = 0
            if hurdleB >= 2:
                chk = False
                break
        cnt += 1
    if c > d and (s[d-2] == '
        print "No"
    elif chk == False:
        print "No"
    else:
        print "Yes"

if __name__ == "__main__":
    main()

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

if c < d:
    ans = "Yes"
    for i in range(a,d-1):
        if s[i] == "
            ans = "No"
        
if c > d:
    ans = "No"
    for i in range(b-2,d-1):
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
                ans = "Yes"
    for i in range(a,c-1):
        if s[i] == "
            ans = "No"

print(ans)

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

s_list = [c for c in s]

def check(start, end , s):
    kukan = "".join(s_list[start - 1 : end])
    if "
        return False
    if kukan[0] == "
        return False
    return True

def check2(start, end, s):
    kukan = "".join(s_list[start - 1 : end])
    if "..." in kukan:
        return True
    else:
        return False

ans = check(a, c, s) and check(b, d, s)

if c > d:
    ans = ans and check2(b - 1, d + 1, s)

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

Solution (Python):
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n,a,b,c,d = f()
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = input()

    has_2_consecu = 0
    for i in range(a+1, max(c,d)-1):
        if s[i]=='
            has_2_consecu = 1
            break



    if has_2_consecu:
        print('No')
        return

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




solve()

Solution (Python):
def has_path(start, goal):
    for step in range(start, goal):
        if (not isRoad[step]) and (not isRoad[step-1]):
            return False
    return True


N, A, B, C, D = map(int, input().split())
S = input()
isRoad = [True if c == "." else False for c in S]

if C <= B:      
    if has_path(A, C) and has_path(B, D):
        print("Yes")
    else:
        print("No")
    exit()
elif C < D:    
    if has_path(A, C) and has_path(B, D):
        print("Yes")
    else:
        print("No")
    exit()
else:       
    for i in range(B - 1, D):   
        if isRoad[i - 1] and isRoad[i] and isRoad[i + 1]:
            print("Yes")
            exit()
    print("No")

Solution (Python):
import numpy as np

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

reachable_C = np.full(N+2, False, np.bool)
reachable_D = np.full(N+2, False, np.bool)

reachable_C[C] = True
reachable_D[D] = True

for i in range(N)[::-1]:
	if S[i] == '
		continue
	
	if reachable_C[i+1] or reachable_C[i+2]:
		reachable_C[i] = True
	if reachable_D[i+1] or reachable_D[i+2]:
		reachable_D[i] = True

l = max(A, B)
r = min(C, D) + 1

print('Yes'
	if reachable_C[A]
		and reachable_D[B]
		and (
			(A < B and C < D or B < A and D < C)
			or "..." in S[l-1:r+1])
	else 'No')

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

print(ans)

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

if not(S[A:C-1].find('
  if C<D:
    print('Yes')
  elif S[B-2:D+1].find('...')!=-1:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Solution (Python):


n, a, b, c, d = map(int, input().split())
s = " " + input()
Triple_floor = False
before_stat = ""
floor_num = 0
counter = a
for char in s[a:]:
    if(counter > max(c,d)):
        
        break
    if(char == "."):
        floor_num += 1
        if(floor_num >= 3 and counter >= (b+1) and counter <= (d+1)):
            Triple_floor = True
    else:
        floor_num = 0
        if(before_stat == "
            c=d
            Triple_floor = False
            break
    before_stat = char
    counter += 1
if(c<d or Triple_floor):
    print("Yes")
else:
    print("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
L=input()[a-1:max(c,d)]
f=0
r="."
for i in list(L):
  if r=="
    f=1
    break
  r=i

if c < d:
  print('No' if f==1 else 'Yes')
else:
  g=0
  t="
  s="
  for i in range(b-1,d):
    if L[i-1:i+2]=="...":
      g=1
      break
    s=i
  print('No' if f==1 or g==0 else 'Yes')

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

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

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

def check_movable(s):
    cnt = 0
    for v in s:
        if v == '
            cnt += 1
        elif v == '.':
            cnt = 0
        if cnt >= 2:
            return False
    return True
def check_throughable(s):
    cnt = 0
    for v in s:
        if v == '.':
            cnt += 1
        elif v == '
            cnt = 0
        if cnt >= 3:
            return True
    return False
if C < B:
    if check_movable(S[B:D]) and check_movable(S[A:C]):
        print('Yes')
    else:
        print('No')
elif C < D:
    if check_movable(S[B:D]) and check_movable(S[A:B]):
        print('Yes')
    else:
        print('No')
else:
    if check_throughable(S[B-2:D+1]) and check_movable(S[A:C]):
        print('Yes')
    else:
        print('No')

Solution (Python):
N, A, B, C, D = map(int, input().split())
S = '.' + input()
ans = True
if C > D:
  s = B - 1
  while s < D:
    if S[s] == '
      _s = s + 1
    elif S[s + 1] == '
      _s = s + 2
    elif S[s + 2] == '
      _s = s + 3
    else:
      break
    s = _s
  if s >= D:
    ans = False
s = A + 1
while s < C:
  if S[s] != '
    _s = s + 1
  elif S[s + 1] != '
    _s = s + 2
  else:
    ans = False
    break
  s = _s
s = B + 1
while s < D:
  if S[s] != '
    _s = s + 1
  elif S[s + 1] != '
    _s = s + 2
  else:
    ans = False
    break
  s = _s
print('Yes' if ans else 'No')

Solution (Python):
import re
N, A, B, C, D = map(int, input().split())
S = input().replace('.', 'x')

if C < D:
    if len(re.findall('
        print('No')
    elif len(re.findall('
        print('No')
    else:
        print('Yes')
else:
    if len(re.findall('
        print('No')
    elif len(re.findall('xxx', S[B - 2:D + 1])) == 0:
        print('No')
    else:
        print('Yes')

Solution (Python):

 
import math
import numpy as np
import random
import copy
import statistics 
import bisect
import heapq
from collections import defaultdict 

N, A, B, C, D = [ int(x) for x in input().split() ]
A -= 1
B -= 1
C -= 1
D -= 1
S = input() + "

A_blocker = False
B_blocker = False
pass_point = False

A_load = S[A:C+1]
B_load = S[B:D+1]
pass_load = S[B-1:D+2]
if '
    A_blocker = True
if '
    B_blocker = True
if '...' in pass_load:
    pass_point = True

if D < C:
    if (not A_blocker) and (not B_blocker) and pass_point:
        print ("Yes")
    else:
        print ("No")
else:
    if (not A_blocker) and (not B_blocker):
        print ("Yes")
    else:
        print ("No")

Solution (Python):
n,a,b,c,d=map(int,input().split())
s=input()
if c<d:
    if "
        print("No")
    else:
        print("Yes")
else:
    if "
        print("No")
    elif "..." in s[b-2:d+1]:
        print("Yes")
    else:
        print("No")