TnT/Multi_CodeNet4Repair huggingface dataset:
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,a,b,c,d = (int(i) for i in input().split())  
s = input()
e = 0
if c<d:
  if s[a:c+1].count("##")==0 and s[b:d+1].count("##")==0:
    print("Yes")
  else:
    print("No")
else:
  for i in range(b,d+1):
    if s[i-1:i+2]=="...":
      e = 1 
  if e = 1:
    print("Yes")
  elif:
    print("No")

s = input()
e = 0
if c<d:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0:
    print("Yes")
  else:
    print("No")
else:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0 and s.[b-2:d+1].count("...")>0:
    print("Yes")
  else:
    print("No")

n,a,b,c,d = (int(i) for i in input().split())  
s = input()
e = 0
if c<d:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0:
    print("Yes")
  else:
    print("No")
else:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0 and s.[b-2:d+1].count("...")>0:
    print("Yes")
  else:
    print("No")



n,a,b,c,d = (int(i) for i in input().split())  
s = input()
e = 0
if s[a:c+1].count("##")==0 and s[b:d+1].count("##")==0:
  if  c<d :
    print("Yes")
  else :
    for i in range(b,d+1):
      if s[b-1:d+2]=="...":
        e=1
else:
  print("No")
if e==1:
  print("Yes")
else:
  print("No")



n,a,b,c,d = (int(i) for i in input().split())  
s = input()
e = 0
if c<d:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0:
    print("Yes")
  else:
    print("No")
else:
  if s[a:c-1].count("##")==0 and s[b:d-1].count("##")==0 and s[b-2:d+1].count("...")>0:
    print("Yes")
  else:
    print("No")




Verdicts: Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Accepted
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, a, b, c, d = map(int, input().split())
s = input()
s = '.' + s
if '##' in s[a:c] or '##' in s[b:d] or not (d < c and '...' in s[b-1:d+2]):
    print('No')
else:
    print('Yes')


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

Verdicts: Wrong Answer

Accepted
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):
m = max([c, d])
if n>m:
    n = m
    s = s[:n]
    
if '##' in s:
    print('No')
else:
    if c>d:
        if '...' in s[:d]:
            print('Yes')
        else:
            print('No')
    else:
        print('Yes') 

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

n, a, b, c, d = (int(i) for i in input().split())  
s = str(input())
n = len(s)

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

Verdicts: Runtime Error

Runtime Error

Accepted
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, A, B, C, D = map(int,input().split())
S = input()

if C < D:
    S_cut = S[A-1:D]
    num = S_cut.count("##")
    # print(A,B,C,D)
    print(S_cut)
    if num > 0:
        print("No")
    else:
        print("Yes")

else:
    S_cut1 = S[A-1:C]
    
    flg1 = (S_cut1.count("##") == 0)
    # S_cut2 = S[B-1:D+1]
    # print(S_cut1,S_cut2)
    
    # flg2 = (S_cut2.count("...")>=1)
    flg2 = (S_cut1.count("...")>=1)
    if flg1 and flg2:
        print("Yes")
    else:
        print("No")


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

if C < D:
    S_cut = S[A-1:D]
    num = S_cut.count("##")
    # print(S_cut)
    if num > 0:
        print("No")
    else:
        print("Yes")

else:
    S_cut1 = S[A-1:C]
    
    flg1 = (S_cut1.count("##") == 0)
    S_cut2 = S[max(0,B-2):D+1]
    # S_cut2 = S[A-1:D+1]    
    
    flg2 = (S_cut2.count("...")>=1)
    if flg1 and flg2:
        print("Yes")
    else:
        print("No")


Verdicts: Wrong Answer

Accepted
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):
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]
        print(route)
        possible = True
        before = "."
        for si in s:
            if before == si == "#":
                possible = False
                break
            before = si
    elif d < c:
        route = s[a:d - 1]
        print(route)
        possible = True
        before = "."
        for si in s:
            if before == si == "#":
                possible = False
                break
            before = si

        cross_possible = False
        route = s[b:max(n, d + 1)]
        print(route)
        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")







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]
        # print(route)
        possible = True
        before = "."
        for si in route:
            if before == si == "#":
                possible = False
                break
            before = si
    elif d < c:
        route = s[a:d - 1]
        # print(route)
        possible = True
        before = "."
        for si in route:
            if before == si == "#":
                possible = False
                break
            before = si

        cross_possible = False
        route = s[b:d + 1]
        # print(route)
        before = [s[b - 2], s[b - 1]]
        for si in route:
            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")







Verdicts: Wrong Answer

Accepted
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,A,B,C,D = map(int, input().split())
S = [""] + list(input())

def can(start, end):
    for i in range(start, end):
        if S[i] == S[i + 1] == "#":
            return False
    return True

def main():
    if not (can(A, C) and can(B, D)):
        return False

    if C < D:
        flag = False
        for i in range(B, D + 1):
            if S[i - 1] == S[i] == S[i + 1] == ".":
                flag = True
        if not flag:
            return False
    
    return True

if __name__ == "__main__":
    if main():
        print('Yes')
    else:
        print('No')

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

def can(start, end):
    for i in range(start, end):
        if S[i] == S[i + 1] == "#":
            return False
    return True

def main():
    if not (can(A, C) and can(B, D)):
        return False

    if C < D:
        return True
    elif C > D:
        for i in range(B, D + 1):
            if S[i - 1] == S[i] == S[i + 1] == ".":
                return True
        return False

if __name__ == "__main__":
    if main():
        print('Yes')
    else:
        print('No')

Verdicts: Runtime Error

Accepted
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,a,b,c,d = map(int,input().split())
s = input()
if "##" in s[a:c]:
  print("No")
  exit()
elif "##" in s[b:d]:
  print("No")
  exit()
elif c > d:
  if "..." in s[b-2:d+1]:
    print("Yes")
    exit()
else:
  print("No")


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


n,a,b,c,d=map(int,input().split())
s=input()
if s[b:d].count('##')>0:
    print('No')
    exit()

if c>d:
    flg=True
    if s[b-2:d+1].count('...')>0:
        flg=False
    if flg:
        print('No')
        exit()

if s[a:c].count('##')>0:
    print('No')
    exit()

print('Yes')


Verdicts: Wrong Answer

Wrong Answer

Accepted
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, a, b, c, d = (map(int, input().split()))
S = input()
if '##' in S:
	print('No')
elif d<c:
	if not '...' in S:
    	print ('No')
	if d <= n and S[d]=='#' and d-2 >= 0 and S[d-2]=='#':
		print('No')
else:
	print('Yes')



n, a, b, c, d = (map(int, input().split()))
S = input()
import re
if '##' in S:
  return 'No'
elif d>c and not '...' in S:
  return 'No'
elif c==d:
  return 'No'
else:
  return 'Yes'

n, a, b, c, d = (map(int, input().split()))
S = input()
if '##' in S:
	print('No')
elif d<c:
	if not '...' in S:
    	print ('No')
	if d <= n and S[d]=='#' and d-2 >= 0 and s[d-2]=='#':
		print('No')
else:
	print('Yes')



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')
elif d < c and not '...' in S[b-2:d+1]:
        print('No')
else:
    print('Yes')


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
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):
if "##" in S[A-1:C]:
	print("No")
elif "##" in S[B-1:D]:
	print("No")
elif D < C:	# A jumps over B
	if not "..." in S[B-2:D+1]:
		print("No")
	else:
		print("Yes")
else:
	print("Yes")

if "##" in S[A-1:C]:
	print("No")
elif "##" in S[B-1:D]:
	print("No")
elif D < C:	# A jumps over B
	if not "..." in S[B-1:C]:
		print("No")
	elif S[B-1:D].count("...") < 2:
		if S[D-2:D+1] == "#..":
			print("No")
		else:
			print("Yes")
	else:
		print("Yes")
else:
	print("Yes")

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

if "##" in S[A-1:C]:
	print("No")
elif "##" in S[B-1:D]:
	print("No")
elif D < C:	# A jumps over B
	if not "..." in S[B-2:D+1]:
		print("No")
	else:
		print("Yes")
else:
	print("Yes")

Verdicts: Runtime Error

Runtime Error

Accepted
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):
m, a, b, c, d = [int(i) for i in input().split()]
s = input()
if(c<d):
  print("YES")
else:
  if('...' in s[b-2:d+1]) == 1 and ('##' in s[b-2:d]) == 0:
    print("YES")
  else:
    print("NO")
    
  

n, a, b, c, d = map(int, input().split())
s = list(input())
last = ""
for i in range(a, max(c, d)):
    if last == "#" and s[i] == "#":
        print("No")
        exit()
    last = s[i]
flag = False
if c > d:
    s[b - 1] = "#"
    for i in range(a, c):
        if last == "#" and s[i] == "#":
            flag = True
        last = s[i]
    s[b - 1] = "."
    count = 0
    for i in range(b - 1, d + 1):
        if s[i] == ".":
            count += 1
            if count == 3:
                flag = False
        else:
            count = 0
else:
    for i in range(b, d):
        if last == "#" and s[i] == "#":
            flag = True
        last = s[i]
if not flag:
    print("Yes")
else:
    print("No")


Verdicts: Wrong Answer

Accepted
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):
def solve():
    N,A,B,C,D = [int(s) for s in input().split() if s]
    S = input()
    
    flag = True
    for i in range(B+1, max(C,D)-1):
        if S[i] == '#' and S[i+1] == '#':
            flag = False
    
    if C > D:
        flag = False
        for i in range(B+1, max(C,D)-2):
            if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
                flag = True
    
    print('yes' if flag else 'no')

solve()

def solve():
    N,A,B,C,D = [int(s)-1 for s in input().split() if s]
    S = input()
    N += 1
    
    flag = True
    for i in range(A+1, max(C,D)-1):
        if S[i] == '#' and S[i+1] == '#':
            flag = False
    
    if flag and C > D:
        flag = False
        for i in range(B-1, D):
            if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
                flag = True
    
    print('Yes' if flag else 'No')

solve()

Verdicts: Wrong Answer

Accepted
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, a, b, c, d = map(int, input().split())
s = input()
ss = s[min(a-1, b-1): max(c, d)]
if ss.count("##") or ((d < c and ss.count("...") == 0) or c < d):
    print("No")
else:
    print("Yes")


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

Verdicts: Wrong Answer

Accepted
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, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if s[i-1] == s[i] == "#":
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, c):
        if s[i-1] == s[i] == "#":
            print("No")
            break
    else:
        for j in range(b-1, d):
            if s[j-1] == s[j] == s[j+1] == "."):
                print("Yes")
                break
        else:
            print("No")

N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
    flag = "Yes"
    for i in range(x-1 ,y-2):
        if S[i] ==  S[i+1] == "#":
            flag = "No"
  return flag

def judgeJumpOver(S, x , y):
    flag = "No"
    for i in range(x-1 ,y):
        if S[i-1] ==  S[i] ==  S[i+1] == ".":
            flag = "Yes"
        break
 
  return flag
 
result = "Yes"
if(C > D):
    result = judgeJumpOver(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, A, C)
print(result)

n, a, b, c, d = list(map(int, input().split()))
s = input()
if d > c:
    for i in range(a, d-1):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        print("Yes")
else:
    for i in range(a, d):
        if (s[i-1] == "#") & (s[i] == "#"):
            print("No")
            break
    else:
        for j in range(b-1, min(c, n-1)):
            if (s[j-1] == ".") & (s[j] == ".") & (s[j+1] == "."):
                print("Yes")
                break
        else:
            if b > c:
                print("Yes")
                break
            else:
                print("No")

            

N ,A ,B ,C ,D = list(map(int,input().split()))
S = input()
 
def judgeArrive(S, x, y):
    flag = "Yes"
    for i in range(x-1 ,y-2):
        if S[i] ==  S[i+1] == "#":
            flag = "No"
    return flag

def judgeJumpOver(S, x , y):
    flag = "No"
    for i in range(x-1 ,y):
        if S[i-1] ==  S[i] ==  S[i+1] == ".":
            flag = "Yes"
            break
    return flag
 
result = "Yes"
if(C > D):
    result = judgeJumpOver(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, B, D)
if(result == "Yes"):
    result = judgeArrive(S, A, C)
print(result)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
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):
import bisect,copy,heapq,itertools,string
from collections import *
from math import *
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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

flag = 0
for i in range(min(a,b)+1,max(c,d)):
        if (a < i < c or b < i < d) and s[i] == s[i-1] == '#':
                print("No")
                exit()       
        elif max(a,b) <= i <= min(c,d) and s[i-1] == s[i] == s[i+1] == '.':
                flag = 1

if c > d and flag == 0:
        print("No")
else:
        print("Yes")

import bisect,copy,heapq,itertools,string
from collections import *
from math import *
import sys
def input() : return sys.stdin.readline().strip()
def INT()   : return int(input())
def MAP()   : return map(int,input().split())
def LIST()  : return list(MAP())

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

flag = 0
for i in range(min(a,b)+1,max(c,d)):
        if (a < i < c or b < i < d) and s[i] == s[i-1] == '#':
                print("No")
                exit()       
        elif max(a,b) <= i <= min(c,d) and s[i-1] == s[i] == s[i+1] == '.':
                flag = 1

if c > d and flag == 0:
        print("No")
else:
        print("Yes")

Verdicts: Runtime Error

Accepted
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):
s = str(input())
flag=1
ans = 0
while(flag==1):
    flag=0
    if s.count("ABC") > 0:
        flag=1
        ans = ans+s.count("ABC")
        s.replace("ABC","BCA")

print(ans)

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] == "#" and s[i+1] == "#":
            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] == "#" and s[i+1] == "#":
            ans = "No"

print(ans)

Verdicts: Wrong Answer

Accepted
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):
A = input() 
found = False
count = 0
while not found:
    n = A.count("ABC")
    if n == 0:
        found = True
    else:
        count += n
        A = A.replace("ABC","BCA")
print(count)

N,A,B,C,D = map(int,input().split())
a = input()
k = A
found = True
ffond = False
b = 0
c = 0
if C <D :
    while  found == True and k < D:
        if a[k] == "#":
            b += 1
        else:
            b = 0
        if b == 2:
            found = False
        k += 1
    if found == False:
        print("No")
    else:
        print("Yes")
else:
    while  found == True and k < C:
        if a[k] == "#":
            b += 1
            if k > B-3 and k <= D:
                c = 0
        else:
            b = 0
            if k > B-3 and k <=D:
                c +=1
        if b == 2:
            found = False
        if c == 3:
            ffond = True
        k += 1
    if found == False or ffond == False:
        print("No")
    else:
        print("Yes")




Verdicts: Wrong Answer

Accepted
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):
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):
        print("No")
    else:
        print("Yes")
else:
    try:
        s.index("...")
    except:
        print("No")
        sys.exit()
    else:
        if x(s):
            print("No")
        else:
            print("Yes")

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()
print(s[a-1:c-1])
if c<d:
    if x(s[a-1:c-1]):
        print("Yes")
    else:
        print("No")
else:
    try:
        s[a-1:d-1].index("...")
    except:
        print("No")
    else:
        if x(s[a - 1:d - 1]):
            print("Yes")
        else:
            print("No")

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")

Verdicts: Wrong Answer

Wrong Answer

Accepted
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,a,b,c,d = map(int,input().split())
S = list(input())
S = ['#'].expand(S)
print(S)

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

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

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

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

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

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

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

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

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

Verdicts: Runtime Error

Accepted
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, a, b, c, d = list(map(int, input().split()))
s = input()
if '##' in s[a-1:max(c, d)]:
    out = 'No'
elif c < d:
    out = 'Yes'
elif '...' in s[b-2:d]:
    out = 'Yes'
else:
    out = 'No'

n, a, b, c, d = list(map(int, input().split()))
s = input()
if '##' in s[a-1:max(c, d)]:
    out = 'No'
elif c < d:
    out = 'Yes'
elif '...' in s[b-2:d+1]:
    out = 'Yes'
else:
    out = 'No'
print(out)

Verdicts: Wrong Answer

Accepted
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,a,b,c,d = map(int,input().split())
s = input()

max1 = 0
max2 = 0
count = 0

print(s[a-1:max(c,d)])
for i in s[a-1:max(c,d)]:
    if i == '#':
        count += 1
    else:
        max1 = max(max1,count)
        count = 0

count = 0

print(s[b-2:d+1])
for i in s[b-2:d+1]:
    if i == '.':
        count += 1
    else:
        max2 = max(max2,count)
        count = 0

if max1 > 1:
    print('No')
else:
    if c > d:
        if max2 <= 2:
            print('No')
        else:
            print('Yes')
    else:
        print('Yes')


n,a,b,c,d = map(int,input().split())
s = input()
flag = 'Yes'

if '##' in s[a-1:c] or '##' in s[b-1:d]:
    flag = 'No'
if not '...' in s[b-2:d+1] and c > d:
    flag = 'No'
print(flag)


Verdicts: Wrong Answer

Accepted
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):
s = input()
ans = 0
cntA = 0
for i in range(0, len(s) - 1):
    if s[i] == 'A':
        cntA += 1
    elif s[i: i + 2] == "BC":
        ans += cntA
    elif i > 0 and s[i - 1: i + 1] == "BC":
        continue
    else:
        cntA = 0
print(ans)

using namespace std;
 
int main() {
    int N, A, B, C, D;
    string S;
    cin >> N >> A >> B >> C >> D >> S;
    
    S = "#" + S + "#";
 
    auto can_reach = [&](int start, int end) {
        for (int i = start; i + 1 <= end; i++) {
            if (S[i] == '#' && S[i + 1] == '#') return false;
        }

N,A,B,C,D = map(int,input().split())
S = str(input())
ans = "Yes"

S0 = S[:A]
Sa = S[A-1:C]
Sb = S[B-2:D+1]
F = max(C,D)
S1 = S[F:]
#if S0.rfind('##')>=0 and S1.find('##')>=0 :
#    Sfe = S[S0.rfind('##'):(F+S1.find('##'))]
#elif S0.rfind('##')>=0 :
#    Sfe = S[S0.rfind('##'):]
#elif S1.find('##')>=0 :
#    Sfe = S[:(F+S1.find('##'))]
#else :
#    Sfe = S


#if S.find('##')>=0 and A<S.find('ABC')<C or B<S.find('ABC')<D:
if Sa.find('##')>=0 or Sb.find('##')>=0:
    ans = "No"

if A<B<D<C and not '...' in Sb:
    ans = "No"

print(ans)


Verdicts: Wrong Answer

Runtime Error

Accepted
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):
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")


N,A,B,C,D = map(int,input().split())
S = input()
count1 = 0
count2 = 0
if C>D:
    for i in range(B-2,D+1):
        if S[i] == ".":
            count1 += 1
            if count1 ==3:
                break
        else:
            count1 = 0
    for i in range(A-1,C):
        if S[i] == '#':
            count2 +=1
            if count2 == 2:
                break
        else:
            count2 =0
    if count1 == 3 and count2 !=2:
        print("Yes")
    else:
        print("No")
else:
    for i in range(A-1,D):
        if S[i] == "#":
            count2 += 1
            if count2 == 2:
                break
        else:
            count2 = 0
    if count2 != 2:
        print("Yes")
    else:
        print("No")


Verdicts: Wrong Answer

Accepted
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, a, b, c, d = map(int, input().split())
s = str(input())

flag = True
# B -> D
s_bd = s[b:d-1]
for i in range(len(s_bd)-1):
    if s_bd[i:i+2] == "##":
        flag = False
        break
# A -> C
s_ac = s[a:c-1]
if flag:
    for i in range(len(s_ac)-1):
        if s_ac[i:i+2] == "##":
            flag = False
            break
print(s_ac)
print(s_bd)


has_ddd = False
if flag and s_bd[-1] == "#":
    for i in range(len(s_bd)-2):
        if s_bd[i:i+3] == "...":
            has_ddd = True
    if not has_ddd:
        flag = False

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


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

flag = True


s_bd = s[b:d-1]
for i in range(len(s_bd)-1):
    if s_bd[i:i+2] == "##":
        flag = False
        break
s_ac = s[a:c-1]
for i in range(len(s_ac)-1):
    if s_ac[i:i+2] == "##":
        flag = False
        break

if c > d:
    
    if s[d-2] == "#":
        s_bd = s[b-2:d]
        has_ddd = False
        for i in range(len(s_bd)-2):
            if s_bd[i:i+3] == "...":
                has_ddd = True
        if has_ddd == False:
            flag = False

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


Verdicts: Wrong Answer

Accepted
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,a,b,c,d = map(int,input().split())
s = str(input())
if "##" in s[min(a,b):max(c,d)-1]:
  print("No")
  exit()
if d > c:
  if "..." in s[b-2:d+1]:
    print("Yes")
  else:
    print("No")
else:
  print("Yes")


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


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

Verdicts: Wrong Answer

Wrong Answer

Accepted
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, A, B, C, D = map(int,input().split())
st = input()
if C == D :
  print("NO")
elif C < D:
  flag = 0
  st1 = st[A:C+1]
  for i in range(len(st1)-1):
    if st1[1:i+2] == "##":
      flag = 1
      
  st1 = st[B:D+1]
  for i in range(len(st1)-1):
    if st1[i:i+2] == "##":
      flag = 1
  if flag :
    print("NO")
  else:
    print("YES")
    
else:
  flag = 0
  irekaeble = 0
  st1 = st[A:C+1]
  for i in range(len(st1)-1):
    if st1[i:i+2] == "##":
      flag = 1
      
  st1 = st[B:D+1]
  for i in range(len(st1)-1):
    if st1[i:i+2] == "##":
      flag = 1
      
  st1 = st[B-1:C+1]
  for i in range(len(st)-2):
    if st1[i:i+3] == "...":
      irekaeble = 1
  
  if flag or irekaeble == 0:
    print("NO")
  else:
    print("YES")

N, A, B, C, D = map(int,input().split())
st = input()
if C == D :
  print("No")
elif C < D:
  flag = 0
  st1 = st[A-1:C]
  for i in range(len(st1)-1):
    if st1[i:i+2] == "##":
      flag = 1
      
  st1 = st[B-1:D]
  for i in range(len(st1)-1):
    if st1[i:i+2] == "##":
      flag = 1
  if flag :
    print("No")
  else:
    print("Yes")
    
else:
  flag = 0
  irekaeble = 0
  st1 = st[A-1:C]
  for i in range(len(st1)-1):
    if st1[i:i+2] == "##":
      flag = 1
      
  st1 = st[B-1:D]
  for i in range(len(st1)-1):
    if st1[i:i+2] == "##":
      flag = 1
      
  st1 = st[B-2:D+1]
  for i in range(len(st1)-2):
    if st1[i:i+3] == "...":
      irekaeble = 1
  
  if flag or irekaeble == 0:
    print("No")
  else:
    print("Yes")

Verdicts: Wrong Answer

Accepted
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,a,b,c,d = map(int,input().split())
road = input()
if "##" in road[a-1:c-1] or "##" in road[b-1:d-1]:
  print("NO")
else:
  if c < d:
    print("YES")
  else:
    if "..." in road[b-2:c]:
      print("YES")
    else:print("NO")

print("No")

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
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,A,B,C,D=map(int,input().split())
S=input()


print('No')


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

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

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

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

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

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

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

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

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

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

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

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


print('Yes')


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted