Problem: 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.

Submission attempts (in order):
n , a0 , b0 , c0 , d0 = map(int,input().split())
s = input()


if a0 > b0 : 
    a = b0
    b = a0
    c = d0
    d = c0
else : 
    a = a0
    b = b0
    c = c0
    d = d0

right = max(c,d)

for i in range(n-1) :
    if s[i] == '
        if i <= right :
            print('No')
            break
else :
    if c < d :
        print('Yes')
    else :
        for i in range(n-2) :
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' : 
                if i <= d :
                    print('Yes')
                    break
        else :
            print('No')


n , a0 , b0 , c0 , d0 = map(int,input().split())
s = input()


if a0 > b0 : 
    a = b0
    b = a0
    c = d0
    d = c0
else : 
    a = a0
    b = b0
    c = c0
    d = d0

right = max(c,d)

for i in range(n-1) :
    if s[i] == '
        if i <= right :
            print('No')
            break
else :
    if c < d :
        print('Yes')
    else :
        for i in range(n-2) :
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' : 
                if i < d - 1 :
                    print('Yes')
                    break
        else :
            print('No')


n , a0 , b0 , c0 , d0 = map(int,input().split())
s = input()


if a0 > b0 : 
    a = b0
    b = a0
    c = d0
    d = c0
else : 
    a = a0
    b = b0
    c = c0
    d = d0

right = max(c,d)
left = min(a,b)

for i in range(n-1) :
    if s[i] == '
        if i <= right - 2 and i >= left - 1 :
            print('No')
            break
else :
    if c < d :
        print('Yes')
    else :
        for i in range(n-2) :
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' : 
                if i < d - 1 and i >= left - 1 :
                    print('Yes')
                    break
        else :
            print('No')


n , a0 , b0 , c0 , d0 = map(int,input().split())
s = input()


if a0 > b0 : 
    a = b0
    b = a0
    c = d0
    d = c0
else : 
    a = a0
    b = b0
    c = c0
    d = d0

right = max(c,d)
left = min(a,b)
middle = max(a,b)

for i in range(n-1) :
    if s[i] == '
        if i <= right - 2 and i >= left - 1 :
            print('No')
            break
else :
    if c < d :
        print('Yes')
    else :
        for i in range(n-2) :
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' : 
                if i + 1 == b - 1 :
                    print('Yes')
                    break
                if i <= d - 1 and i >= b - 1 :
                    print('Yes')
                    break
        else :
            print('No')


n , a0 , b0 , c0 , d0 = map(int,input().split())
s = input()


if a0 > b0 : 
    a = b0
    b = a0
    c = d0
    d = c0
else : 
    a = a0
    b = b0
    c = c0
    d = d0

right = max(c,d)
left = min(a,b)
middle = max(a,b)

for i in range(n-1) :
    if s[i] == '
        if i <= right - 2 and i >= left - 1 :
            print('No')
            break
else :
    if c < d :
        print('Yes')
    else :
        for i in range(n-2) :
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' : 
                if i < d - 1 and i >= middle - 1 :
                    print('Yes')
                    break
        else :
            print('No')


n , a0 , b0 , c0 , d0 = map(int,input().split())
s = input()


if a0 > b0 : 
    a = b0
    b = a0
    c = d0
    d = c0
else : 
    a = a0
    b = b0
    c = c0
    d = d0

right = max(c,d)

for i in range(n-1) :
    if s[i] == '
        if i <= right :
            print('No')
            break
else :
    if c < d :
        print('Yes')
    else :
        for i in range(n-2) :
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' : 
                if i < d :
                    print('Yes')
                    break
        else :
            print('No')


n , a0 , b0 , c0 , d0 = map(int,input().split())
s = input()


if a0 > b0 : 
    a = b0
    b = a0
    c = d0
    d = c0
else : 
    a = a0
    b = b0
    c = c0
    d = d0

right = max(c,d)

for i in range(n-1) :
    if s[i] == '
        if i <= right - 2 :
            print('No')
            break
else :
    if c < d :
        print('Yes')
    else :
        for i in range(n-2) :
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' : 
                if i <= d - 1 :
                    print('Yes')
                    break
        else :
            print('No')


n , a0 , b0 , c0 , d0 = map(int,input().split())
s = input()


if a0 > b0 : 
    a = b0
    b = a0
    c = d0
    d = c0
else : 
    a = a0
    b = b0
    c = c0
    d = d0

right = max(c,d)

for i in range(n-1) :
    if s[i] == '
        if i <= right - 2 :
            print('No')
            break
else :
    if c < d :
        print('Yes')
    else :
        for i in range(n-2) :
            if s[i] == '.' and s[i+1] == '.' and s[i+2] == '.' : 
                if i < d - 1 :
                    print('Yes')
                    break
        else :
            print('No')


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

def isOk(fr, to):
    if S[fr: to + 1].count('##') > 0:
        return False
    return True

if not (isOk(A, C) and isOk(C, D)):
    print('No')
    exit()

def canSwitch():
    if S[max(A, B) - 1: min(C, D) + 2].count('...'):
        return True
    return False

if A < B and D < C or B < A and C < D:
    if not canSwitch():
        print('No')
        exit()

print('Yes')


Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted