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):
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 
 
a_s = s[a:c]
b_s = s[b:d]
 
 
if d < c:
  print('Yes')
else:
  print('No')

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
 
a_s = s[a:c]
b_s = s[b:d]
 
if c < d:
  santen_flag = True
if d < c:
  if '...' in s[b-1:d]:
    santen_flag = True
  
if not '##' in a_s and not '##' in b_s:
  kome_flag = True
    

else:
	if c < d:
		if kome_flag:
			print('Yes')
		else:
			print('No')
 
	if d < c:
		if kome_flag and santen_flag:
			print('Yes')
		else:
			print('No')

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[a:]
 
if '...' in b_s:
  santen_flag = True
if not '##' in b_s:
  kome_flag = True
    
if not '#' in b_s:
  print('Yes')
else:
  if c < d:
  	if kome_flag:
    	print('Yes')
  	else:
    	print('No')
 
	if d < c:
  		if kome_flag and santen_flag:
    		print('Yes')
  		else:
    		print('No')

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[a:]

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

	if d < c:
  		if kome_flag and santen_flag:
    		print('Yes')
  		else:
    		print('No')
    
if not '#' in b_s:
  

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
 
a_s = s[a:c]
b_s = s[b:d]
 
 
if d < c:
  if '...' in s[b-1:d]:
    santen_flag = True
  
if not '##' in a_s and not '##' in b_s:
  kome_flag = True

else:
	if c < d:
		if kome_flag:
			print('Yes')
		else:
			print('No')
 
	if d < c:
		if kome_flag and santen_flag:
			print('Yes')
		else:
			print('No')

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

print(d)
 
kome_flag = False 
santen_flag = False 
 
a_s = s[a:c]
b_s = s[b:d]
 
 
if d < c:
  if '...' in s[b-1:d]:
    santen_flag = True
    
kome_flag = True
if '##' in a_s or '##' in b_s:
  kome_flag = False
    
#if not '#' in a_s and not '#' in b_s:
#	print('Yes')
if True:
	if c < d:
		if kome_flag:
			print('Yes')
		else:
			print('No')
 
	if d < c:
		if kome_flag and santen_flag:
			print('Yes')
		else:
			print('No')

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])
ten_idx = []
kome_idx = []


if a in kome_idx or b in kome_idx or c in kome_idx or d in kome_idx:
  print('NO')
  
for i, char in enumerate(s):
  if char == '.':
    ten_idx.append(i)
  elif char == '#':
    kome_idx.append(i)

for i in kome_idx:
  if i + 1 in kome_idx:
    print('NO')
    
if c < d:
  print('YES')
if d < c:
  flag = False
  for i in ten_idx:
    if i+1 in ten_idx and i+2 in ten_idx:
      flag = True
      continue
  if flag :
    print('YES')
  if not flag:
    print('NO')

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 
 
a_s = s[a:c]
b_s = s[b:d]
 
 
if d < c:
  if '...' in s[b-2:d+1]:
    santen_flag = True
kome_flag = True
if '##' in a_s or '##' in b_s:
  kome_flag = False
    

if True:
	if c < d:
		if kome_flag:
			print('Yes')
		else:
			print('No')
 
	if d < c:
		if kome_flag and santen_flag:
			print('Yes')
		else:
			print('No')

Verdicts: Wrong Answer

Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Accepted