Problem:


Score : 400 points

Problem Statement

There are N squares arranged in a row, numbered 1, 2, ..., N from left to right.
You are given a string S of length N consisting of . and #. If the i-th character of S is #, Square i contains a rock; if the i-th character of S is ., Square i is empty.

In the beginning, Snuke stands on Square A, and Fnuke stands on Square B.

You can repeat the following operation any number of times:

Choose Snuke or Fnuke, and make him jump one or two squares to the right. The destination must be one of the squares, and it must not contain a rock or the other person.

You want to repeat this operation so that Snuke will stand on Square C and Fnuke will stand on Square D.

Determine whether this is possible.

Constraints

4 \leq N \leq 200\ 000

S is a string of length N consisting of . and #.

1 \leq A, B, C, D \leq N

Square A, B, C and D do not contain a rock.

A, B, C and D are all different.

A < B

A < C

B < D

Input

Input is given from Standard Input in the following format:

N A B C D
S

Output

Print Yes if the objective is achievable, and No if it is not.

Sample Input 1

7 1 3 6 7
.#..#..

Sample Output 1

Yes

The objective is achievable by, for example, moving the two persons as follows. (A and B represent Snuke and Fnuke, respectively.)

A#B.#..

A#.B#..

.#AB#..

.#A.#B.

.#.A#B.

.#.A#.B

.#..#AB

Sample Input 2

7 1 3 7 6
.#..#..

Sample Output 2

No

Sample Input 3

15 1 3 15 13
...#.#...#.#...

Sample Output 3

Yes



Sample input:
7 1 3 6 7
.#..#..


Sample output:
Yes

Submission status: Wrong Answer

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

if C < D:
    S1 = S[A-1:D]
else:
    S1 = S[A-1:C]

fd = S1.find('##')
if fd != -1:
    print('No')
    exit()

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

else:
    S2 = S[B-2:C+1]
    fddot = S2.find('...')

    if fddot == -1:
        print('No')

    else:
        print('Yes')

Submission status: Wrong Answer

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

sunuke = ""
hunuke = ""


if C > D:
    k = ''.join(s[B-1:D+1])
    result = "..." in k
    if result == 0:
        print("No")
        exit()

while B <= D:
    if s[B] == ".":
        B += 1
        if B == D:
            hunuke = "ok"
            break
    elif s[B+1] == ".":
        B += 2
        if B == D:
            hunuke = "ok"
            break
        elif B > D:
            print("No")
            exit()
    else:
        print("No")
        exit()

while A <= C:
    if s[A] == ".":
        A += 1
        if A == C:
            sunuke = "ok"
            break
    elif s[A+1] == ".":
        A += 2
        if A == C:
            sunuke = "ok"
            break
        elif A > C:
            print("No")
            exit()
    else:
        print("No")
        exit()

if sunuke == "ok" and hunuke == "ok":
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# agc034/agc034_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, A, B, C, D = i2nn()
    S = i2s()
    print('No')
    return

main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
''' 
------------------------
author : iiou16
------------------------
'''

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

    # A,Bからみて先が"##"の状態になったら詰み
    if "##" not in S[A:] and "##" not in S[B:]:
        if C < D or C < B:
            # 先にBをDまで移動させればAもたどり着ける
            print("Yes")
        else:
            # AがBを追い抜く必要があるので、
            # その瞬間に#B or B#にならないようにしないといけない
            # BからD+1の間に ... があればOK
            if "..." in S[B-2:D+1]:
                print("Yes")
            else:
                print("No")
    else:
        print("No")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
p = input().split()
n,a,b,c,d = int(p[0]),int(p[1]),int(p[2]),int(p[3]),int(p[4])
s = input()
p = 0
k = False
for i in range(max([a,b])-2,n):
    if s[i] == ".":
        p+=1
    else:
        p = 0
    if p==3:
        k=True
if k or c<d:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

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

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

else:
    S[D - 1] = str("#")
    S[B - 1] = str("#")
    for i in range(B, D - 2, 1):
        if S[i - 1] == "." and S[i] == "." and S[i + 1] == ".":
            t = 1

    for i in range(A - 1, C - 2, 1):
        if S[i] == "#" and S[i + 1] == "#":
            if B <= i and i <= D - 2 and t:
                continue
            if i == B - 1 or i + 1 == B - 1:
                f = 1
                continue
            if (i == D - 1 or i + 1 == D - 1) and f == 0:
                continue
            print("No")
            exit()

print("Yes")

Submission status: Wrong Answer

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


for i in range(N-1):
    if S[i] == "#" and S[i+1] == "#":
        print("No")
        exit()

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

if S[B-1] != "#" and S[B] == ".":
    print("Yes")
    exit()

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

print("No")

Submission status: Wrong Answer

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

S = input()

def AA(mojiretu):
    if '##' in mojiretu:
     print("No")
    else:
     print("Yes")

Scp = S
if C < D:
      AA(Scp[:D])
      
else:
    if "..." in Scp[B-2:D]:
      AA(Scp[:C])
    else:
      Scp = Scp[:D-1]+"#" + Scp[D:]
      AA(Scp[:C])

Submission status: Wrong Answer

Solution code:
def main():
    n,a,b,c,d =  [int(x) for x in input().split()]
    stage = input().rstrip()

    if '##' in stage:
        print('No') 
    elif d < c and not '...' in stage[b-1:d+1]:
        print('No')
    else:
        print('Yes')

if __name__=='__main__':
    main()

Submission status: Wrong Answer

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

if c>d:
  if s[d-2]=="#" or s[d]=="#":
    if s[b-1:d-1].find("...")!=-1:
      print("Yes")
    else:
      print("No")
elif s[a-1:max(c,d)-1].find("##")!=-1:
  print("No")
else:
  print("Yes")

Submission status: Wrong Answer

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

curval = "x"
cnt = 0
initidx = 0
ngarea = [-1]
triarea = [-1]

for idx,val in enumerate(S):
    if val == curval:
        cnt += 1
    else:
        if cnt >= 2 and curval == '#':
            ngarea.append(initidx + 1)
        elif cnt >= 3 and curval == '.':
            triarea.append(initidx + 1)
        initidx = idx
        cnt = 1
    curval = val
else:
    if cnt >= 2 and curval == '#':
        ngarea.append(initidx + 1)
    elif cnt >= 3 and curval == '.':
        triarea.append(initidx + 1)

if C < D:
    isBflg = True
    isABflg = True
    for ngp in ngarea:
        if ngp > B and ngp < D:
            isBflg = False
        if ngp > A and ngp < B:
            isABflg = False
    if isBflg and isABflg:
        print('Yes')
        exit()
    else:
        print('No')
        exit()
else:
    isChangeFlg = False
    # Changepoint = -1
    for trp in triarea:
        if trp > A and trp + 1 >= B:
            Changepoint = trp + 1
            isChangeFlg = True
            break
    if isChangeFlg == False:
        print('No')
        exit()
    else:
        isBflg = True
        isABflg = True
        isChange2DFlg = True
        for ngp in ngarea:
            if ngp > B and ngp < Changepoint:
                isBflg = False
            if ngp > A and ngp < B:
                isABflg = False
            if ngp > Changepoint and ngp < D:
                isChange2DFlg = False
        if isBflg and isABflg and isChange2DFlg:
            print('Yes')
            exit()
        else:
            print('No')
            exit()

Submission status: Wrong Answer

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

def scan(a_, c_):
    mae = ''
    for i, l in enumerate(s, 1):
        if a_ > i:
            continue
        if c_ == i:
            return True
        if mae == l == '#':
            return False
        mae = l

def scan2(a_, c_):
    mae = ''
    maemae = ''
    for i, l in enumerate(s, 1):
        if a_ > i:
            continue
        if c_ == i:
            return False
        if mae == maemae == l == '.':
            return True
        maemae = mae
        mae = l

def scan3(a_, c_):
    for i, l in enumerate(s, 1):
        if a_ > i:
            continue
        if i == c_ + 1:
            return l == '.'
        if l == '#':
            return False

if d > c and scan(a, c) and scan(b, d):
    print('Yes')
elif d < c and scan(a, c) and scan(b, d) and (scan2(b, d) or scan3(a, b)):
    print('Yes')
else:
    print('No')

Submission status: Wrong Answer

Solution code:
length, a, b, c, d = [int(i) for i in input().split()]
road = input()

if '##' in road:
    print('No')

if '...' in road:
    print('Yes')

if a < b:
    a, b = b, a

if c > d:
    print('No')

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int, input().split())
S = input()
S =S+"#"
S =S+"#"
S =S+"#"
answer = 1
a = 1
distance = []
distance_2 = []
for n in range(A-1,max(C,D)):
  a += 1
  if S[n] == "#":
    distance.append(a)
    a = 0
if 1 in distance:
  answer = 0
if D < C and answer == 1:
  a = 1
  for n in range(B-2,D+2):
    a += 1
    if S[n] == "#":
      distance_2.append(a)
      a = 0
  if max(distance_2) < 4:
    answer = 0
if answer == 1:
  print("Yes")
else:
  print("No")

Submission status: Wrong Answer

Solution code:
## AからＣ　ＢからＤに移動させたい
## C<D なら簡単

N,A,B,C,D = map(int,input().split())
S = input()
flag = 0
obs = []
esc = []
ans = 1

#ＡとＢで小さいほうを low
if A<B:
    low = A
    mid1 = B
else:
    low = B
    mid1 = A
#ＣとＤで大きいほうをhigh
if C<D:
    high = D
    mid2 = C
else:
    high = C
    mid2 = D



for i in range(low,high):
     if S[i]=="#" and flag == 1:
         obs.append(i)
         flag = 0
     elif S[i] == "#":
         flag = 1
     else: flag = 0

 # obsに通れない位置を入力
flag = 0
for i in range(low,high):
      if S[i]=="." and flag == 2:
          esc.append(i)
          flag = 0
      elif S[i] == ".":
          flag += 1
      else:
          flag = 0

if len(obs)!=0:
    ans = 0

if D<C :
    flag = 0
    for i in range(len(esc)):
        if mid1< esc[i] < mid2:
            flag = 1
    if flag == 0:
        ans = 0


if ans==1:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# agc034/agc034_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, A, B, C, D = i2nn()
    S = i2s()
    if '##' not in S[B-1:D] and '##' not in S[A-1:C]:
        if C < D:
            print('No')
        elif  '...' in S[A:D]:
            print('Yes')
        else:
            print('No')
    else:
        print('No')
    return

main()

Submission status: Wrong Answer

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

flag3 = 0
flagno = 0

if c > d:

    for i in range(a,c-3):

        if s[i:i+2] == "##":
            flagno += 1
            break

    if flagno == 0:

        for i in range(b,d-1):
        
            if s[i-2:i+1] == "...":
                flag3 += 1
                break
    
    if flagno == 0 and flag3 > 0:
        print("Yes")

    else:
        print("No")

else:

    for i in range(a,c-3):

        if s[i:i+2] == "##":
            flagno += 1
            break

    for i in range(b,d-3):

        if s[i:i+2] == "##":
            flagno += 1
            break
    
    if flagno == 0:
        print("Yes")

    else:
        print("No")

Submission status: Wrong Answer

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from copy import copy
import numpy as np
from numpy.fft import fft, ifft
from fractions import gcd


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


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


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n, a, b, c, d = MAP()
s = list(input())

lis3  =[]
ct_iwa=0

tmp3 = []
tmp_iwa=[]
for i in range(n):
    #print(s[i])
    if s[i] =='.':
        tmp3.append(i)
        if len(tmp_iwa) > 1:
            ct_iwa += 1
            
        tmp_iwa.clear()
    else:
        tmp_iwa.append(1)
        if len(tmp3) > 2:
            tmp=tmp3.copy()
            lis3.append(tmp)
               
        tmp3.clear()
    
    #print(tmp3)


if len(tmp3) == 3:
    lis3.append(tmp3)
if len(tmp_iwa) > 1:
    ct_iwa += 1

#print(lis3, ct_iwa)

flag=0

if c < d:
    #print('1')
    if ct_iwa == 0:
        print('Yes')
    else:
        print('No')
else:
    #print('2')
    for x in lis3:
        if x[1] < d - 1 and ct_iwa == 0:
            print('Yes')
            flag = 1
            break

    if flag == 0:
        print('No')

Submission status: Wrong Answer

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

if "##" in s[A-1:max(C,D)]:
  print("No")
  quit()
st,e=0,0

for spl in s.split("##"):
  e += (len(spl)+2)
  if st <A<max(C,D)<=e:
    break
  st+= (len(spl)+2)

if "..." in s[st:e] or B<C<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:
    print('No')
elif c < d:
    print('Yes')
elif not '...' in s:
    print('No')
else:
    i = -1
    while True:
        i = s.find('...', i + 1)
        
        if b <= i + 1 < d:
            print('Yes')
            break
        elif i + 1 >= d:
            print('No')
            break
        else:
            pass

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
santen_flag = False

b_s = s[b:]

if '...' in b_s:
  santen_flag = True
if not '##' in b_s:
  kome_flag = True
    
    
if kome_flag:
  if c < d:
    print('Yes')
  elif d < c:
    if santen_flag:
      print('Yes')
    else:
      print('No')

Submission status: Wrong Answer

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

s = input()

if s[b:d-1].count('##') > 0:
    b_chk = False
else:
    b_chk = True

s_ac = s[a:c-1]
if c < d:
    if s_ac.count('##') > 0:
        a_chk = False
    else:
        a_chk = True
else:
    a_chk = False
    if s_ac[0] == "." and ("#" + s_ac[1:]).count("##") == 0:
        a_chk = True
        
    if s_ac[-1] == "." and (s_ac[:-1] + "#").count("##") == 0:
        a_chk = True
        
    if s_ac.count("...") > 0:
        a_chk = True

if b_chk and a_chk:
    print("Yes")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D=map(int,input().split())
S=input()
print("No" if "##" in S else "No" if "..." not in S and C>D else "Yes")

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# agc034/agc034_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, A, B, C, D = i2nn()
    S = i2s()
    if '##' not in S[B-1:D] and '##' not in S[A-1:C]:
        if C < D:
            print('Yes')
        elif  '...' in S[A:D]:
            print('No')
        else:
            print('No')
    else:
        print('No')
    return

main()

Submission status: Wrong Answer

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

lis = list(input())

lis.append(".")
lis.append(".")

dbl = -1
middle = -1

for i in range(n):
  if lis[i] == "#" and lis[i+1] == "#":
    dbl = i
    
for k in range(a-1,c):
  if lis[k] == "." and lis[k+1] == "." and lis[k+2] == ".":
    middle = k+1
    break
    

if dbl != -1 and not (c-1 < dbl and d-1 < dbl):
  print("No")
elif c > d:
  if middle == -1:
    print("No")
  elif middle+1 == b: 
    print("Yes")
  elif middle+1 < c:
    print("Yes")
  else:
    print("No")
else:
  print("Yes")

Submission status: Wrong Answer

Solution code:
from sys import stdin
def main():
    N,A,B,C,D = map(int, stdin.readline().rstrip().split())
    S = stdin.readline().rstrip()
    Slist = list(S)
    A = A-1
    B = B-1
    C = C-1
    D = D-1
    
    # 前提 A Bはゴールよりも右にいると不可能
    if (C < A or D < B):
      print("No")
      return
    
    # 連続岩チェック
    index = -1
    while True:
      index = S.find('##', index + 1)
      if (index == -1) or (C < index and D < index):
        break
      if (A < index and index < C) or (B < index and index < D):
        print('No')
        return
    
    # 初期位置チェック
    if D-B==2 and Slist[B+1] =='#' and A < B and D < C:
        print('No')
        return
    if C-A==2 and Slist[A+1] =='#' and B < A and C < D:
        print('No')
        return
    if (B < A) and (Slist[C-1] =='#' and (A == C-2 or (C >= 4 and A==C-3 and Slist[C-4]=="#") or (C >= 4 and A==C-5 and Slist[C-4]=="#"))):
        print("No")
        return
    if (A < B) and (Slist[D-1] =='#' and (B == D-2 or (D >= 4 and B==D-3 and Slist[D-4]=="#") or (D >= 4 and B==D-5 and Slist[D-4]=="#"))):
        print("No")
        return
    
    print('Yes')

input = lambda: stdin.readline()
main()

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 > 1:
      print("Yes")
    else:
      judge = s_change.count("...")
      if judge >0:
        print("Yes")
      else:
        print("No")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int,input().split())
S = str(input())
dp = list(S)
dp[A-1] = "A"
dp[B-1] = "B"
flag_A = 0
flag_B = 0
for i in range(N-2):
    if dp[i] == "B" and flag_B != 1:
        dp[i] = "."
        if dp[i+3] == dp[D-1] and dp[i+3] == ".":
            dp[D-1] = "B"
            flag_B = 1
            dp[i] = "."
        elif dp[i+2] == dp[D-1] and dp[i+2] == ".":
            dp[D-1] == "B"
            flag_B = 1
            dp[i] = "."
        elif dp[i+3] == ".":
            dp[i+3] = "B"
            dp[i+1] = "."
        elif dp[i+2] == ".":
            dp[i+2] = "B"
            dp[i] = "."
for i in range(N-2):
    if dp[i] == "A" and flag_A != 1:
        dp[i] = "."
        if dp[i+3] == dp[C-1] and dp[i+3] == ".":
            dp[C-1] = "A"
            flag_A = 1
            dp[i] = "."
        elif dp[i+2] == dp[C-1] and dp[i+2] == ".":
            dp[C-1] == "A"
            flag_A = 1
            dp[i] = "."
        elif dp[i+3] == ".":
            dp[i+3] = "A"
            dp[i+1] = "."
        elif dp[i+2] == ".":
            dp[i+2] = "A"
            dp[i] = "."
if dp[D-1] == "B" and dp[C-1] == "A":
    if dp.index(dp[D-1]) > dp.index(dp[C-1]):
        print("Yes")
    else:
        print("No")
else:
    print("No")

Submission status: Wrong Answer

Solution code:
l = list(map(str, input().split()))
str=input()

num = int(l[0])
ast = l[1]
bst = l[2]
afin=l[3]
bfin=l[4]
if(afin=="#" or bfin=="#"):
    print("No")



if(ast > bst):
    st=int(bst)
    fin=int(ast)
if(bst > ast):
    st=int(ast)
    fin=int(bst)




kiritorist= str[st:num]
kiritorifin=str[fin:num]

if(kiritorist.find('##')>0):
    print("No")

if(kiritorist.find('##')<0):
    if((ast<bst and afin<bfin)or(bst<ast and bfin<afin)):
        print("Yes")

    if((ast<bst and bfin<afin)or(bst<ast and afin<bfin)):
        if(kiritorifin.find('...'))>0:
            print("Yes")
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
def judge1(x,y,s):
    count = 0
    slice = s[x:y+1]
    print(slice)
    slice2 = [slice[i:i+2] for i in range(0,y-x+1,2)]
    return slice2
def judge1(x,y,s):
    count = 0
    slice = s[x:y+1]
    print(slice)
    slice2 = [slice[i:i+3] for i in range(0,y-x+1,3)]
    print(slice2)
    return slice2

N,A,B,C,D = map(int,input().split())
S = input()
ans = 0
ans2 = 0
if C>D:
    E = judge1(A-1,C,S)
    for i in range(len(E)):
        if E[i].count(".") == 3:
            ans2 = 1
            break
    if ans2 == 1:
        print("Yes")
    else:
        print("No")
else:
    E = judge1(B-1,D,S)
    for i in range(len(E)):
        if E[i].count("#") == 2:
            ans = 0
            break
    if ans == 1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

    
ans="Yes"
for i in range(a,max(c,d)-1):
  if s[i]=="#" and s[i+1]=="#":
    ans="No"

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

Submission status: Wrong Answer

Solution code:
n, a_, b_, c_, d_ = map(int, input().split())
s_ = input()

def unchi(a,b,c,d,s):
  if(c_ > d_):
    ss, s = s, s[:b] + '#' + s[b+1:]
    
  if (("##" in s[b:d].split(".")) == False):
    b = d
    s = s[:b] + '#' + s[b+1:]
  
  if(c_ > d_):
    s = ss
  if(("##" in s[a:c].split(".")) == False):
    a = c
    s = s[:a] + '#' + s[a+1:]
  
  if(a==c and b==d):
    print("Yes")
  else:
    print("No")
    
if (c_ < d_):
  unchi(a_-1,b_-1,c_-1,d_-1,s_)
else:
  unchi(b_-1,a_-1,d_-1,c_-1,s_)

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(max(C,D)):
    if S[i] == '#' and S[i+1] == '#':
        print('No')
        exit()
if C > D:
    for i in range(A, max(C,D)-1):
        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:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from copy import copy
import numpy as np
from numpy.fft import fft, ifft
from fractions import gcd


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


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


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n, a, b, c, d = MAP()
s = list(input())

lis3  =[]
ct_iwa=0

tmp3 = []
tmp_iwa=[]
for i in range(n):
    #print(s[i])
    if s[i] =='.':
        tmp3.append(i)
        if len(tmp_iwa) > 1:
            ct_iwa += 1
            
        tmp_iwa.clear()
    else:
        tmp_iwa.append(1)
        if len(tmp3) > 2:
            tmp=tmp3.copy()
            lis3.append(tmp)
               
        tmp3.clear()
    
    #print(tmp3)


if len(tmp3) == 3:
    lis3.append(tmp3)
if len(tmp_iwa) > 1:
    ct_iwa += 1

#print(lis3, ct_iwa)

flag=0

if c < d:
    #print('1')
    if ct_iwa == 0:
        print('Yes')
    else:
        print('No')
else:
    #print('2')
    for x in lis3:
        if x[-1] < d - 1 and ct_iwa == 0:
            print('Yes')
            flag = 1
            break

    if flag == 0:
        print('No')

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
p=list(input())
count=0
r1=0
for i in range(b,d-1):
    if p[i-1]=="#" and p[i]=="#" :
        r1=1
        break;
    else:
        r1=0
count=0
r2=0
for j in range(a,c-1):
    if p[j-1]=="#" and p[j]=="#" :
        r2=1
        break;
    else:
        r2=0

for k in range(b,d-1):
    if p[k-1]=='.' and  p[k]=='.' and  p[k+1]=='.' and k<(d-2):
        r4=0
        break;
    else:
        r4=1

        
if r1==0 and r2==0:
    if c<d:
        print("Yes")
    elif r4==0:
        print("Yes")
    else:
        print("No")
        
else:
    print("No")

Submission status: Wrong Answer

Solution code:
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces1148A_live
from collections import Counter
gi = lambda : list(map(int,input().strip().split()))
n, a, b, c, d = gi()
s = input()
if a > b:
	a, b = b, a
	c, d = d, c
a -= 1
b -= 1
c -= 1
d -= 1
s = s[:a] + "a" + s[a+1:b] + "b" + s[b+1:]
if c <= d:
	temp = s[a:c]
	if "##" in temp or s[c] == "#":
		print("No")
		exit()
	temp = s[b:d]
	if "##" in temp or s[d] == "#":
		print("No")
		exit()
	print("Yes")
	exit()
temp = s[a:c]
if "##" in temp or "..." not in temp or s[c] == "#" or s[d] == "#":
	print("No")
	exit()
print("Yes")

Submission status: Wrong Answer

Solution code:
line = input().split()
object_ = input()

N = int(line[0])
A = int(line[1])-1
B = int(line[2])-1
C = int(line[3])-1
D = int(line[4])-1

placing_objects = [True if s == '#' else False for s in list(object_)]

def main():
    if (A < B and C < D) or (A > B and C > D):
        for i in range(N-1):
            if placing_objects[i] and placing_objects[i+1]:
                print('No')
                return
        print('Yes')
        return
    else:
        possible_trans = False
        trans_index = []
        for i in range(N-1):
            if placing_objects[i] and placing_objects[i+1]:
                print('No')
                return
            if i < N-2 and (not placing_objects[i]) and (not placing_objects[i+1]) and (not placing_objects[i+2]):
                possible_trans = True
                trans_index.append(i+1)
        if not possible_trans:
            if C < D:
                if placing_objects[C-1] or placing_objects[C+1]:
                    print('No')
                    return
            else:
                if placing_objects[D-1] or placing_objects[D+1]:
                    print('No')
                    return
        else:
            if A > B:
                if A > trans_index[0]:
                    print('No')
                    return
            else:
                if B > trans_index[0]:
                    print('No')
                    return
        print('Yes')
        
main()

Submission status: Wrong Answer

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

for i in range(max(C, D)):
    if S[i:i+2] == "##":
        print("No")
        quit()

if C > D and C - D == 1:
    if S[D-2:D] == "#." and S.count("...") == 0:
        print("No")
        quit()
    else:
        print("Yes")
        quit()
else:
    print("Yes")

Submission status: Wrong Answer

Solution code:
N, A, B, C, D = map(int, input().split())
S = list(input())
for i in range(len(S) - 1):
    if S[i] == S[i+1] == '#':
        print('No')
        exit()

C_1 = C-2
try:
    if S[C] != '%':
        C_2 = C
except:
    C_2 = C-1

D_1 = D-2
try:
    if S[D] != '%':
        D_2 = D
except:
    D_2 = D-1

if (A > B and D > C) or (B > A and C > D):
    if (S[C_1] == '#' or S[C_2] == '#' or S[D_1] == '#' or S[D_2] == '#') and (abs(C-D) < 2):
        print('No')
    else:
        print('Yes')
else:
    print('Yes')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def spaceinput():
    return list(map(int, input().split(" ")))


def count3(S, l, r):
    for i in range(l, r+1):
        if S[i:i+3] == "...":
            return True
    return False


def is_twocontinusblock(S, l, r):
    for i in range(l, r):
        if S[i:i+2] == "##":
            return True
    return False


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


def solve():
    if is_twocontinusblock(S, A, C-1) or is_twocontinusblock(S, B, D-1):
        return False
    if D < C:
        if count3(S, B-1, D):
            return True
        else:
            return False

    return True


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

Submission status: Wrong Answer

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

rock = 0
max_rock = []
non = 0
max_non = []
k = 0
for i in s:
    if i == '#':
        rock += 1
        if non >= 3:
            max_non.append([non, k])
        non = 0
    else:
        non += 1
        if rock >= 2:
            max_rock.append([rock, k])
        rock = 0
    if k == n-1:
        k += 1
        if non >= 3:
            max_non.append([non, k])
        if rock >= 2:
            max_rock.append([rock, k])
    k += 1

max_non1 = [i for i in max_non if i[1]-2 < d and i[1]-2 < c and i[1]-2 > a and i[1]-2 > b]
max_rock1 = [i for i in max_rock if i[1] < d and i[1] < c and i[1] > a and i[1] > b]
max_non2 = max_non
max_rock2 = [i for i in max_rock if (i[1] < d and i[1] > b) or (i[1] > a and i[1] > c)]
# print(max_non1)
# print(max_rock1)
if b > c and c < d :
    if len(max_rock2) > 0:
        print('No')
    else:
        print('Yes')
elif c > d:
    if len(max_non1) > 0:
        print('Yes')
    else:
        print('No')
elif len(max_rock1) > 0:
    print('No')
else:
    print('Yes')

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = (int(i) for i in input().split())  
s = str(input())[a-1:]
n = len(s)

m = max([c, d])
if n>m:
    n = m
    s = s[:n]
    
if '##' in s:
    print('No')
elif b>c:
    print('Yes')
else:
    if c>d:
        if '...' in s[:d]:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# agc034/agc034_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, A, B, C, D = i2nn()
    S = i2s()
    print('Yes')
    return

main()