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 = (int(i) for i in input().split())
road=input()

def aida(x, y, list):
    #print(list[x-1:y])
    iwa=0
    space=0
    for l in list[x-1:y]:
        if l=="#":
            space=0
            if iwa==1:
                return 0
            else:
                iwa=1
        else:
            iwa=0
            if space==2:
                return 2
            elif space==1:
                space=2
            else:
                space=1
    return 1 #岩が連続していない
    

#print(road)
#print(road[a-1:b])

if c<b:
    t=aida(a,c,road)
    u=aida(b,d,road)
    if t>0 and u>0:
        print('Yes')
    else:
        print('No')
elif c<d:
    t=aida(a,c,road)
    u=aida(b,d,road)
    if t>0 and u>0:
        print('Yes')
    else:
        print('No')
else:
    t=aida(a,d,road)
    u=aida(b-1,min(c+1,n),road)
    #print(t,u)
    if t>0 and u==2:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5)


def LI(): return [int(x) for x in sys.stdin.readline().split()]


def SI(): return input()


def main():
    N, A, B, C, D = LI()
    S = SI()

    M = [0 for _ in range(A-1)]
    a = 0
    for s in S[A-1:max(C, D)]:
        if s == ".":
            a = 0
            M.append(0)
        else:
            if a == 1:
                print("No")
                return
            a = 1
            M.append(1)
    if D > C:
        print("Yes")
        return
    a = 0
    for m in M[B:D]:
        if m == 0:
            a += 1
        else:
            a = 0
        if m == 3:
            print("Yes")
            return
    if M[B-2] == 0 and M[B] == 0:
        print("Yes")
        return
    if M[D-2] == 0 and M[D] == 0:
        print("Yes")
        return
    print("No")


main()

Submission status: Wrong Answer

Solution code:
n,a,b,c,d = map(int, input().split())
s = input()
ans = "Yes"
sharp = 0
dot = 0
for i in s[:max(c,d)]:
    if i == ".":
        sharp = 0
    else:
        sharp += 1
        if sharp == 2:
            ans = "No"
            break
if c > d and ans == "Yes":
    ans = "No"
    for i in s[b-2:d+1]:
        if i == ".":
            dot += 1
            if dot == 3:
                ans = "Yes"
                break
        else:
            dot = 0
print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int, A: int, B: int, C: int, D: int, S: str): 
    if(S[A-1:C].count('##') == 0 and S[B-1:D].count('##') == 0):
        if(D < C and S[B-1:D].count('...') == 0):
            print(NO)
        # elif()
        else:
            print(YES)
    else:
        print(NO)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, A, B, C, D, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,A,B,C,D=map(int,input().split())
S=input()
if C<D:
    for i in range(A-1,D-1):
        if S[i]=='#' and S[i+1]=='#':
            print('No')
            exit()
    print('Yes')
    exit()
elif C>D:
    for j in range(A-1,D-1):
        if S[j]=='#' and S[j+1]=='#':
            print('No')
            exit()
    if any(S[k-1]=='.' and S[k]=='.' and S[k+1]=='.' for k in range(B-1,D-1)):
        print('Yes')
        exit()
print('No')

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# すぬけ君がふぬけ君を追い越す必要があるならば
# 追い越すためのスペースが必要になる

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

    if S[A-1:C].count('##'):
        return 0

    if S[B-1:D].count('##'):
        return 0

    if D < C and not(S[B-1:D].count('...')):
        return 0

    return 1

print(['No','Yes'][main()])

Submission status: Wrong Answer

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

def check_cont_rock(s, e):
  use_road = road[s:e]
  return "##" in use_road

def check_cont_road(s, e):
  use_road = road[s:e]
  return "..." in use_road

if D > C:
  if check_cont_rock(A-1, D-1):
    print("No")
  else:
    print("Yes")
else:
  if check_cont_rock(A-1, C-1):
    print("No")
  else:
    if check_cont_road(B-2, D):
      print("Yes")
    else:
      print("No")

Submission status: Wrong Answer

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


if __name__ == "__main__":
    [n, a, b, c, d] = li()
    s = input()
    if c < d:
        route = s[a:d - 1]
        possible = True
        before = "."
        for si in s:
            if before == si == "#":
                possible = False
                break
            before = si
    elif d < c:
        route = s[a:d - 1]
        possible = True
        before = "."
        for si in s:
            if before == si == "#":
                possible = False
                break
            before = si

        cross_possible = False
        route = s[b:max(n, c + 1)]
        before = [s[b - 2], s[b - 1]]
        for si in s:
            before.append(si)
            before = before[-3:]
            if before[0] == before[1] == before[2] == ".":
                cross_possible = True
        possible = possible and cross_possible

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

# C<Dの場合
# 目的地までの間に岩が２連続で存在しなければ可能
# D<Cの場合
# BとCの間に岩がないマスが３連続で存在すれば可能

Submission status: Wrong Answer

Solution code:
import numpy as np
from collections import defaultdict
from functools import reduce

# s = input()
# n = int(input())
# A = list(map(int, input().split()))
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 and not ('##' in s2):
    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')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n, a, b, c, d = map(lambda x: int(x) - 1, input().split())
s = list(input())

if c < d:
    while b < d:
        if s[b + 1] == '.':
            b += 1
        elif b + 2 < n and s[b + 2] == '.':
            b += 2
        else:
            print('No')
            exit()
    while a < c:
        if s[a + 1] == '.':
            a += 1
        elif a + 2 < n and s[a + 2] == '.':
            a += 2
        else:
            print('No')
            exit()
    print('Yes')
else:
    s[b] = 'b'
    while a < b < d:
        if s[a + 1] == '.':
            a += 1
        elif a + 2 < n and s[a + 2] == '.':
            a += 2
        else:
            if s[b + 1] == '.':
                s[b] = '.'
                s[b + 1] = 'b'
                b += 1
            elif b + 2 < n and s[b + 2] == '.':
                s[b] = '.'
                s[b + 2] = 'b'
                b += 2
            else:
                print('No')
                exit()
    while a < c:
        if s[a + 1] == '.':
            a += 1
        elif a + 2 < n and s[a + 2] == '.':
            a += 2
        else:
            print('No')
            exit()
    while b < d:
        if s[b + 1] == '.':
            b += 1
        elif b + 2 < n 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()

if c<d:
    if '##' in s:
        print('No')
    else:
        print('Yes')
else:
    if a>b:#これはない
        if '##' in s:
            print('No')
        else:
            print('Yes')
    else:
        if b-1<0:
            print('No')
        else:
            if '...' 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()

# route = []
# for i in range(n):
#     r = []
#     if s[i] == '#':

rock = 0
max_rock = 0
non = 0
max_non = 0
l = []
for i in s:
    if i == '#':
        rock += 1
        max_non = max(max_non, non)
        non = 0
    else:
        non += 1
        max_rock = max(max_rock, rock)
        rock = 0

if d > c:
    print('Yes')
else:
    if max_non >= 3:
        print('Yes')
    else:
        print('No')

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

n,a,b,c,d = [int(i)-1 for i in input().split()]
n+=1
s = input()

def check(x,y):
    ok = 1
    num = 0
    for moji in s[x:y]:
        if moji == "#":
            num+=1
        else:
            num = 0
        if num >= 2:
            ok = 0
            break
    return ok

def check3(x,y):
    ok = 0
    num = 0
#    print(s)
#    print(s[x-1:y+2],x,y)
    for moji in s[x-1:y+2]:
        if moji == ".":
            num+=1
        else:
            num = 0
        if num >= 3:
            ok = 1
            break
    return ok


if c < d:
    if check(a,c) and check(b,d):
        print("Yes")
    else:
        print("NO")

else:
    if check3(b,d) and check(a,c):
        print("Yes")
    else:
        print("NO")

Submission status: Wrong Answer

Solution code:
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)
    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')


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(max(0,max(A,B)-2),max(C,D)):
    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')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

def readInt():
    return int(input())

def readList():
    return list(input().split())

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

def check(s, x_from, x_to):
    for x in range(x_from, x_to-1):
        can_jump = False
        for dx in range(0, 2):
            if s[x+dx] == '.':
                can_jump = True
                break
        if not can_jump:
            return False
    return True


def main():
    n, a, b, c, d = readListI()
    a -= 1
    b -= 1
    c -= 1
    d -= 1
    s = input()

    if c > d:
        # 抜く必要があり、...がb-1<=x<=dにないといけないのでその判定をする
        can_swap = False
        for x in range(b-1, d-1):
            can_swap_here = True
            for dx in range(0, 3):
                if x+dx >= len(s):
                    can_swap_here = False
                    break
                if s[x+dx] == '#':
                    can_swap_here = False
                    break
            if can_swap_here:
                can_swap = True
                break
        if not can_swap:
            print("No")
            return

    # それぞれがたどりつけるか (##がないか) を調べれば良い
    if not check(s, a, c):
        print("No")
        return
    if not check(s, b, d):
        print("No")
        return
    print("Yes")


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int,input().split())
s = input()
if '##' in s:
    print('No')
else:
    if C > D:
        if '...' in s[A:D]:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes')

Submission status: Wrong Answer

Solution code:

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

if "##" in s[a:max(c,d)] :
    print("No")
elif c < d:
    print("Yes")
else:
    if s[b-1] == "." and s[b+1] == ".":
        print("Yes")
    elif "..." in s[a:c]:
        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:c]) or ('##' in S[b-1:d]): print('No')
else:
    if d < c:
        if ('...' in S[b-1:d]): print('Yes')
        else: print('No')
    else: print('Yes')

Submission status: Wrong Answer

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    n, a, b, c, d = LI_()
    s = S()
    flg = False
    if c > d:
        for i in range(b,d):
            if s[i] == "." and s[i + 1] == "." and s[i - 1] == ".":
                flg = i
                break
        if not flg:
            print("No")
            return
    for i in range(a+1, max(c,d)-1):
        if s[i] == "#" and s[i + 1] == "#":
            print("No")
            return
    print("Yes")
    
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Submission status: Wrong Answer

Solution code:
import sys

fin = sys.stdin.readline
N, A, B, C, D = [int(elem) for elem in fin().split()]
cell_list = fin().split()[0]

init_max = max(A, B)
init_min = min(A, B)

after_min_cells = cell_list[init_min:]
after_max_cells = cell_list[init_max:]
# 途中に#が2つ連続しないか
if '##' in after_min_cells:
    result = 'No'
# 入れ替えが必要かどうか
elif (A-B) * (C-D) < 0:
    # 途中に.が3つ連続するかどうか（＝入れ替えが可能かどうか）
    if '...' in after_max_cells:
        result = 'Yes'
    else:
        result = 'No'
else:
    result = 'Yes'

print(result)

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int,input().split())
a= input()
f = 0
s = 0
d = 1
t = []
k = []

f1 = 0
s1 = 0
d1 = 1
t1 = []
k1 = []


for i in a[A-1:]:
    if i == "." and f ==1:
        k.append(d)
        s = 1
        f = 0
    elif i == ".":s+=1
    
    elif i == "#" and f==0:
        t.append(s)
        d = 1
        f = 1
    elif i == "#":d+=1
else:
    if f==1:
        k.append(d)
    else:
        t.append(s)
for i in a[B-1:]:
    if i == "." and f1 ==1:
        k1.append(d1)
        s1 = 1
        f1 = 0
    elif i == ".":s1+=1
    
    elif i == "#" and f1==0:
        t1.append(s)
        d1 = 1
        f1 = 1
    elif i == "#":d1+=1
else:
    if f1==1:
        k1.append(d1)
    else:
        t1.append(s1)
# print(t,k)
# print(t1,k1)
if C < D :
    if len(k) == sum(k):
        print("Yes")
    else:
        print("No")
else:
    if len(k) == sum(k) and all([i > 2 for i in t1]):
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

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

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='#'+input()+'#'

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

Submission status: Wrong Answer

Solution code:
n, a, b, c, d = [int(item) for item in input().split()]
s = "#" + input().rstrip() + "#"

front = min(a, b, c, d)
back = max(a, b, c, d)
for i in range(front, back):
    if s[i] == "#" and s[i+1] == "#":
        print("No")
        exit()
if d > c:
    print("Yes")
    exit()
state = "No"
if d < c:
    for i in range(b, d):
        if s[i-1] == "." and s[i] == "." and s[i+1] == ".":
            state = "Yes"
            break
print(state)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()+"#"*2
e,f=True,False
for i in range(n):
    if s[i]+s[i+1]=="#"*2:
        if a<i<c or b<i<d:
            print("No")
            break
    else:
        if s[i]+s[i+1]+s[i+2]=="."*3:
            if b<=i+1<=d:
                f=True
else:
    if c<d:
        print("Yes")
    else:
        if f:
            print("Yes")
        else:
            print("No")

Submission status: Wrong Answer

Solution code:
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 C < D:
    if "##" in s[A-1:D]:
        print("No")
    else:
        print("Yes")
else:
    if "..." in s[A-1:C] and "##" not in s[A-1:C]:
        print("Yes")
    else:
        print("No")

Submission status: Wrong Answer

Solution code:
n,a,b,c,d=map(int,input().split())
s=input()
flag=0
span=0
buf=-5
if(c<d):
    for i in range(a-1,d):
        if(s[i]=='#' and s[i+1]=='#'):
            flag=1
            break
else:
    for i in range(a-1,c):
        if(s[i]=='#' and s[i+1]=='#'):
            flag=1
            break
        elif s[i]=='#':
            buf=max([span,buf])
            span=0
        else:
            span+=1
    if buf<=2:
        flag=1
        #print(buf)
print('No' if flag==1 else 'Yes')

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def yes():
    print("Yes")  # type: str


def no():
    print("No")  # type: str


def solve(N: int, A: int, B: int, C: int, D: int, S: str):
    #
    if C < D:                   # 追い越さなくても良い場合
        # ２連岩なければ通れる
        for i in range(A, N-1):
            if S[i:i+2] == "##":
                no()
                return
        yes()
        return
    else:                       # 追い越す必要がある場合
        # できるだけ早く追い越す

        sunuke = A-1            # 1-index, 0-index
        funuke = B-1

        def move(place, other=funuke):
            if place == N-1:
                return False
            if place+1 <= N-1 and S[place+1] == "." and place+1 != other:
                return place+1
            elif place+2 <= N-1 and S[place+2] == "." and place+2 != other:
                return place+2
            else:
                return False

        while True:
            sunuke = move(sunuke, funuke)
            if sunuke > funuke:
                break
            if sunuke != False:
                continue
            funuke = move(funuke, sunuke)
            if funuke == False:
                break
        if sunuke == False and funuke == False:
            # 追い越せなかった
            no()
            return
        # 追い越せたなら
        if sunuke <= C and funuke <= D:
            for i in range(sunuke, N-1):
                if S[i:i+2] == "##":
                    no()
                    return
            yes()
            return
        else:
            no()
            return
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, A, B, C, D, S)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int,input().split())
s = input()
State = "Yes"
for i in range(B-1,D-1):
    if s[i] == "#" and s[i+1] == "#":
        State == "No"
        break
if C < D:
    for i in range(A-1,C-1):
        if s[i] == "#" and s[i+1] == "#":
            State = "No"
            break
elif State == "Yes":
    State = "No"
    for i in range(B-2,D-1):
        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            State = "Yes"
            break
    for i in range(D,C-1):
        if s[i] == "#" and s[i+1] == "#":
            State = "No"
            break
print(State)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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+1) <= n and S[a+1] == "." and (a+1) != b:
    a += 1
  elif (a+2) <= n and S[a+2] == "." and (a+2) != b:
    a += 2
  elif (b+1) <= n and S[b+1] == "." and (b+1) != a:
    b += 1
  elif (b+1) <= 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")

Submission status: Wrong Answer

Solution code:
N,A,B,C,D=(int(x) for x in input().split())
S=input()
def Solve():
    if '##' in S[B:D-1] or '##' in S[A:C-1]:#道中に石が2つ並んでたらその時点でアウト
        return 'No'
    if C<D:
        return 'Yes'
    if '...' in S[B-1:D]:
        return 'Yes'
    else:
        return 'No'
    
print(Solve())

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(N: int, A: int, B: int, C: int, D: int, S: str):
    if A > B:
        A,B = B,A
        C,D = D,C

    if A > C or B > D:
        print(NO)
        return

    for i in range(A-1,C-1):
        if S[i] == "#" and S[i+1] == "#":
            print(NO)
            return

    for i in range(B-1,D-1):
        if S[i] == "#" and S[i+1] == "#":
            print(NO)
            return

    if C > D:
        bOK = False
        for i in range(B-1,D-2):
            if S[i] == "." and S[i+1] == "." and S[i+2] == "." and i+2 != A-1: 
                bOK = True
                break

        if not bOK:
            print(NO)
            return

    print(YES)







# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    D = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, A, B, C, D, S)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N,A,B,C,D = map(int,input().split())
S = input()
rock = []
for i in range(N):
	if S[i] == '#':
		rock.append(i+1)

nRock = len(rock)

# renzoku
for i in range(nRock-1):
	if rock[i+1] - rock[i] == 1:
		if A < rock[i] or B < rock[i]:
			print("No")
			exit()

# A ... B ... C ... D
if C < D:
	print("Yes")
	exit()

# A ... B ...#.....#... D ... C
for i in range(nRock):
	if i == 0:
		if rock[i] >= 2:
			if B < rock[i]-1:
				print("Yes")
				exit()
		continue
	if rock[i] - rock[i-1] > 3:
		if B < rock[i-1]-1:
			if D == rock[i-1]+1:
				print("No")
				exit()
			else:
				print("Yes")
				exit()
print("No")

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import numpy as np
from functools import lru_cache
import time

def main(): 
    if True:
        N,A,B,C,D = list(map(int, input().split()))
        S = np.asarray(list(str(input())))
    else:
        pass

    scount = 0
    dcount = 0
    swapok = False
    #print(S[A:D])
    for i in range(A,max(C,D)):
        s = S[i]
        if s == "#":
            dcount = 0
            scount += 1
            if scount == 2:
                print("No")
                exit()
        else:
            scount = 0
            if i > B:
                dcount += 1
                if dcount == 3:
                    swapok = True
    
    if (C>D) & (not swapok):
        print("No")
    else:
        print("Yes")

if __name__ =='__main__':
    main()

Submission status: Wrong Answer

Solution code:
#A問題
N,A,B,C,D = map(int,input().split())
Slist = list(str(input()))
if C < D:
    now = B-1
    Rock = 0
    flag = 0
    for i in range(D-B):
        if i == 0:
            pass
        else:
            if Slist[i] == "#":
                Rock+=1
                if Rock == 2:
                    flag = 1
                    break
            else:
                Rock = 0
    now = A-1
    Rock = 0
    for i in range(C-A):
        if i == 0:
            pass
        else:
            if Slist[i] == "#":
                Rock+=1
                if Rock == 2:
                    flag = 1
                    break
            else:
                Rock = 0

    if flag == 1:
        print("No")
    else:
        print("Yes")
    
else:
    now = B-1
    Rock = 0
    flag = 0
    for i in range(D-B):
        if i == 0:
            pass
        else:
            if Slist[i] == "#":
                Rock+=1
                if Rock == 2:
                    flag = 1
                    break
            else:
                Rock = 0
    now = A-1
    Rock = 0
    mass = 0
    masslist = []
    for i in range(C-A):
        if i == 0:
            mass+=1
        else:
            if Slist[i] == "#":
                Rock+=1
                masslist.append(mass)
                mass = 0
                if Rock == 2:
                    flag = 1
                    break
            else:
                Rock = 0
                mass+=1
    masslist.sort(reverse=True)
    if masslist[1] <= 2:
        flag = 1
    
    if flag == 1:
        print("No")
    else:
        print("Yes")

Submission status: Wrong Answer

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

if C < D:
  if not "##" in S[B:D + 1] and not "##" in S[A:C]:
    print("Yes")
  else:
    print("No")
else:
  if not "##" in S[B:D + 1] and not "##" in S[A:C] and ("..." in S[B if A + 1 != A else A:C + 2]):
    print("Yes")
  else:
    print("No")

Submission status: Wrong Answer

Solution code:
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
cnt = 0
cntf = 0
for i in range(min(sunke,hunke)-1,max(Gs,Gh)):
    if f == 0:
        if s[i]=="#":
            f = 1
            cnt = 0
        else:
          cnt += 1
    else:
        if s[i]=="#":
            print("No")
            exit()
        else:
            f = 0
            cnt += 1
    if cnt == 3:
      cntf = 1

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