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()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(A-1,D:
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(A-1,C):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B -2,D-1):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)
    

N = input()
N = int(N)
N,K = (int(i) for i in input().split())
s = [[ i for i in input().split()] for i in range(N)]


N,A,B,C,D = (int(i) for i in input().split())
S = input()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(len(S)-1):
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(len(S)-1):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B,D-2):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)
    

N,A,B,C,D = (int(i) for i in input().split())
S = input()
S = list(S)

result = "Yes"
onon = True

if C < D:
    for i in range(A-1,D):
        if S[i] == "#" and S[i + 1] == "#":
            result =  "No"
else:
    result = "No"
    for i in range(A-1,C):
        if S[i] == "#" and S[i + 1] == "#":
            onon = False
    if onon:
        for i in range(B -2,D-1):
            if S[i] == "." and S[i + 1] == "."and S[i + 2] == ".":
                result = "Yes"


print(result)

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):
import math
import numpy as np


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


def main():
    _, A, B, C, D = inputs()
    S = input()
    ans = []
    if '##' in S[A:C]:
        ans.append(True)
    else:
        ans.append(False)
    if '##' in S[B:D]:
        ans.append(True)
    else:
        ans.append(False)
    if D < C:
        if '...' in S[B-2: D+1]:
            ans.append(True)
        else:
            ans.append(False)

    if all(ans):
        ans = 'Yes'
    else:
        ans = 'No'
    print(ans)


if __name__ == '__main__':
    main()


import math
import numpy as np
 
 
def inputs(): return list(map(int, input().split()))
 
 
def main():
    _, A, B, C, D = inputs()
    S = input()
    maxDst = max(C, D)
    courseA = S[A-1:C]
    courseB = S[B-1:D]
    cnt = 0
    ans = []
    for i in courseB:
        if i == '#':
            cnt += 1
        else:
            cnt = 0
        if cnt == 2:
            ans.append(False)
            break
    else:
        ans.append(True)
    cnt = 0
    for i in courseA:
        if i == '#':
            cnt += 1
        else:
            cnt = 0
        if cnt == 2:
            ans.append(False)
            break
    else:
        ans.append(True)
    if D < C:
        if '...' in S[B-2: D+1]:
            ans.append(True)
        else:
            ans.append(False)

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

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):
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  _, s_s, f_s, s_e, f_e = map(int, input().split())
  n = input().strip()

  if s_e == f_e:
    print('NO')
  elif '##' in n[s_s:max(s_e, f_e)]:
    print('NO')
  elif s_e < f_e:
    print('YES')
  elif '...' in n[f_s - 1:f_e + 2]:
    print('YES')
  else:
    print('NO')


if __name__ == '__main__':
  main()



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


def main():
  _, s_s, f_s, s_e, f_e = map(int, input().split())
  n = input().strip()

  s_s = s_s - 1
  s_e = s_e - 1
  f_s = f_s - 1
  f_e = f_e - 1

  if '##' in n[s_s + 1:s_e] or '##' in n[f_s + 1:f_e]:
    print('No')
  elif s_e < f_e:
    print('Yes')
  elif '...' in n[f_s - 1:f_e + 2]:
    print('Yes')
  else:
    print('No')


if __name__ == '__main__':
  main()



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):
# python template for atcoder1
import sys

N, A, B, C, D = map(int, input().split())
L = list([v for v in input()])

HOP = [1, 2]
dp_d = [0]*N
dp_d[B-1] = 1
for i in range(N):
    if L[i] == "#":
        continue
    for h in HOP:
        dst = i+h
        if dst < N and L[dst] == ".":
            dp_d[dst] = max(dp_d[dst], dp_d[i])
dp_c = [0]*N
dp_c[A-1] = 1
for i in range(N):
    if L[i] == "#":
        continue
    for h in HOP:
        dst = i+h
        if dst < N and L[dst] == ".":
            dp_c[dst] = max(dp_c[dst], dp_c[i])
reachable = False
if dp_c[C-1] == 1 and dp_d[D-1] == 1:
    reachable = True

if not reachable:
    print("No")
elif C < D:
    print("Yes")
else:
    if "..." in "".join(L[B-2:min(C, D)]):
        print("Yes")
	e;se:
      print("No")

N, A, B, C, D = map(lambda x: int(x)-1, input().split())
L = input()
reachable = "##" in L[A:C+1] or "##" in L[B:D+1]
interupt = "..." in L[B-1:D+2]
if reachable and (C < D or interupt):
    print("Yes")
else:
    print("No")


N, A, B, C, D = map(lambda x: int(x)-1, input().split())
L = input()

reachable = not ("##" in L[A:C+1] or "##" in L[B:D+1])
interupt = "..." in L[B-1:D+2]
if reachable and (C < D or interupt):
    print("Yes")
else:
    print("No")


Verdicts: 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):
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

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

cnt = 0

for i in range(n):
    if s[i] == "#":
        cnt += 1
    else:
        break

s = s[cnt:]

cnt = 0

for i in range(len(s))[::-1]:
    if s[i] == "#":
        cnt += 1
    else:
        break

s = s[:len(s)-cnt]

if (a < b and c < d) or (a > b and c > d):
    if "##" not in s:
        print("Yes")
    else:
        print("No")
else:
    if ("..." in s) and ("##" not in s):
        print("Yes")
    else:
        print("No")

print(s)

import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

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

cnt = 0

for i in range(n):
    if s[i] == "#":
        cnt += 1
    else:
        break

s = s[cnt:]

cnt = 0

for i in range(len(s))[::-1]:
    if s[i] == "#":
        cnt += 1
    else:
        break

s = s[:len(s)-cnt]

if (a < b and c > d) or (a > b and c < d):
    if "##" not in s:
        print("Yes")
    else:
        print("No")
else:
    if ("..." in s) and ("##" not in s):
        print("Yes")
    else:
        print("No")


import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

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

if c < d:
    if "##" not in s[a-1:d-1]:
        print("Yes")
    else:
        print("No")
else:
    if ("..." in s[b-2:d+1]) and ("##" not in s[a-1:c-1]):
        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 = str(input())
E = max(C,D)
AE = S[A:E+1]
BD = S[B-2:D+1]
check = 0
if "##" in AE:
  check = 1
else:
  check = 0
if check == 0 and C > D:
  if "..." in BD:
    check = 0
  else:
    check = 1
if check == 0:
  print("OK")
else:
  print("MISS")

N,A,B,C,D = map(int,input().split())
S = str(input())
E = max(C,D)
AE = S[A:E]
BD = S[B-2:D+1]
if "##" in AE:
  print("NO")
elif C > D and "..." not in BD:
  print("NO")
else:
  print("YES")

N,A,B,C,D = map(int,input().split())
S = str(input())
E = max(C,D)
AE = S[A:E]
BD = S[B-2:D+1]
check = 0
if "##" not in AE:
  pass
else:
  check = 1
if "..." in BD and C > D:
  pass
else:
  check = 1
if check == 0:
  print("YES")
else:
  print("NO")



N,A,B,C,D = map(int,input().split())
S = str(input())
E = max(C,D)
AE = S[A:E+1]
BD = S[B-2:D+1]
check = 0
if "##" in AE:
  check = 1
  break
else:
  check = 0
if check == 0 and C > D:
  if "..." in BD:
    check = 0
  else:
    check = 1
    break
if check == 0
  print("OK")
else:
  print("MISS")


N,A,B,C,D = map(int,input().split())
S = str(input())
E = max(C,D)
AE = S[A:E]
BD = S[B-2:D+1]
if "##" in AE:
  print("No")
elif C > D and "..." not in BD:
  print("No")
else:
  print("Yes")

Verdicts: Wrong Answer

Wrong Answer

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):
import sys
INPUT = sys.stdin.readline
 
def SINGLE_INT(): 
    return int(INPUT())
def MULTIPLE_INT_LIST(): 
    return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): 
    return map(int, INPUT().split())
def SINGLE_STRING(): 
    return INPUT()
def MULTIPLE_STRING(): 
    return INPUT().split()

N, A, B , A_goal, B_goal = MULTIPLE_INT_MAP()
S = SINGLE_STRING()
 
def surpass():
    if '...' in S[B-2:B_goal+1]:
        return 'Yes'
	else:
        return 'No'
 
 
if '##' in S[A-1: A_goal+1] or '##' in S[B-1:B_goal+1]:
    print('No')

else:
    if A_goal < B_goal:
        print('Yes')
    else:
        print(surpass())

import sys
INPUT = sys.stdin.readline

def SINGLE_INT(): return int(INPUT())
def MULTIPLE_INT_LIST(): return list(map(int, INPUT().split()))
def MULTIPLE_INT_MAP(): return map(int, INPUT().split())
def SINGLE_STRING(): return INPUT()
def MULTIPLE_STRING(): return INPUT().split()

N, A, B , A_goal, B_goal = MULTIPLE_INT_MAP()
S = SINGLE_STRING()

def surpass():

    if '...' in S[B-2:B_goal+1]:
        return 'Yes'
    else:
        return 'No'


if '##' in S[A-1: A_goal+1] or '##' in S[B-1:B_goal+1]:
    print('No')

else:
    if A_goal < B_goal:
        print('Yes')
    else:
        print(surpass())


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

#include<string>
#include<list>
#include<map>

#include<cmath>

using namespace std;

using lli = long long int;


int main(void){
	lli N,A,B,C,D;
	cin >> N >> A >> B >> C >> D;
	--A,--B,--C,--D;
	string S;
	cin >> S;
	for (int i = A; i < max(C,D); ++i) {
		if (S.substr(i, 2) == "##") {
			cout << "No" << endl;
			return 0;
		}
	}
	if (D > C) {
		cout << "Yes" << endl;
		return 0;
	}
	auto X=vector<lli>(S.size());
	X[0] = S[0] == '#' ? 0 : 1;
	for (size_t i = 1; i < N; ++i) {
		X[i] = (S[i] == '#') ? 0 : (X[i-1] + 1);
	}
	for (auto i = A; i < D; ++i) {
		if (X[i] >= 3) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

import itertools as it
import collections as col
import heapq
import sys
sys.setrecursionlimit(10**9)

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

for i in range(A,C):
    if S[i] == '#' and S[i+1] == '#':   
        print('No')
        exit()

for i in range(B,D):
    if S[i] == '#' and S[i+1] == '#':   
        print('No')
        exit()

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

X=[-1]*N
X[B-1] = 0 if S[B-1] == '#' else 1
for i in range(B,D+2):
    X[i] = 0 if S[i] == '#' else (X[i-1] + 1)
    if X[i] >= 3:
        print('Yes')
        exit()
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:
    print("No")
elif (S[C-2])=="#" and C>D:
    print("No")
elif (S[C])=="#" and C>D:
    print("No")
else:
    print("Yes")


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

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


N,A,B,C,D=map(int,input().split())
S=input()
print("No" if "##" in S else "No" if "..." not in S[B-1.D-1] and C>D else "Yes")


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

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

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


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

if "##" in S[A:C-1] or "##" in S[B:D-1]:
    print("No")
    exit()
elif C>D and "..." not in S[B-2:D+1]:
    print("No")
else:
    print("Yes")

Verdicts: Runtime Error

Runtime Error

Runtime Error

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 main():
    n,a,b,c,d=map(int,input().split(' '))
    s=input()
    result = 'Yes'
    if a<b<d<c:
        tmp =0
        cnt=0
        for i in range(b-2,d+1):
            if s[i]=='#'and s[i+1]=='#':
                result='No'
                break
            if s[i]=='.':
                tmp +=1
            else:
                if cnt < tmp:
                    cnt = tmp
                    tmp =0

        if max(cnt,tmp) < 3:
                return raise(NameError)
        if result =='Yes':
            for i in range(a,c-1):
                if s[i]=='#'and s[i+1]=='#':
                    result='No'
    else:
        for i in range(b,d-1):
            if s[i] =='#' and s[i+1]=='#':
                result ='No'
                break
        if result=='Yes':
            for i in range(a,c-1):
                if s[i] =='#' and s[i+1]=='#':
                    result = 'No'
    print(result)

main()

n, a, b, c, d = map(int, input().split(' '))
s = input()
def rock(a,b):
    tmp = 0
    result = 1
    for i in s[a:b]:
        if tmp==2:
            result = 0
            break
        if i =='#':
            tmp +=1
        else:
            tmp=0
    return result
def main():
    result =0
    if c<d:
        result = min(rock(a,c-1),rock(b,d-1))
    else:
        result = min(rock(a,c-1),rock(b,d-1))
        if result ==1:
            result = 0
            for i in range(b-1,d):
                if s[i-1]=='.' and s[i]=='.' and s[i+1]=='.':
                    result = 1
    if result ==0:
        print('No')
    else:
        print('Yes')

main()

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

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

    if C > D:
        for i in range(N-2):
            if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
                print('Yes')
                exit()

        print('No')
        exit()

    else:
        print('Yes')

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

for i in range(A-1,C):
    if S[i] == '#' and S[i+1] == '#':
        print('No')
        exit()

for ii in range(B-1,D):
    if S[ii] == '#' and S[ii+1] == '#':
        print('No')
        exit()

if C > D:
    for j in range(B-1,D):
        if S[j-1] == '.' and S[j] == '.' and S[j+1] == '.':
            print('Yes')
            exit()

    print('No')
    exit()

else:
    print('Yes')
    exit()

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()
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("No")
  else:
    s_change= "".join(slist[A:C-1])
    #print(s_change)
    judge = s_change.count("..")
    #print(judge)
    if judge > 1:
      print("Yes")
    else:
      print("No")

print("No")

print("YES")

N, A, B, C, D = map(int,input().split())
S = input()
slist = list(S)
buf = "".join(slist[A:max(C,D)-1])
 
judge = buf.find("##")
 
if judge != -1:
  print("No")
else:
  if C < D:
    print("Yes")
  else:
    s_change= "".join(slist[B-2:D+1])
    judge = s_change.count("...")
    if judge > 0:
      print("Yes")
    else:
      print("No")

Verdicts: Wrong Answer

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()
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('NO' if flag==1 else 'YES')

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(b-2,d-1):
        if(s[i]=='.' and s[i+1]=='.' and s[i+2]=='.'):
            flag=0
            break
        else:
            flag=1
    
print('No' if flag==1 else '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):
#!/usr/bin/env python
# coding: utf-8

# In[2]:


N, A, B, C, D = map(int, input().split())
S = input()
"""
7 1 3 7 6
.#..#..
"""


# In[25]:


S = input()


# In[26]:


#print(A, B, C, D)


# In[37]:


k = []
try:
    st = S.index(".")+1
except:
    print("No")
for i in range(N):
    
    if i==0:
        m = S[i]
        count = 1
    else:
        if S[i] == m:
            count += 1
        else:
            k.append(count)
            m = S[i]
            count = 1
        
    if i == A-1:
        wa = len(k)
    if i == B-1:
        wb = len(k)
    if i == C-1:
        wc = len(k)
    if i == D-1:
        wd = len(k)
    if i == N-1:
        k.append(count)

if S[i] == '.':
    dot = k[::2]
    sharp = k[1::2]
else:
    dot = k[1::2]
    sharp = k[2::2]
    wa -= 1
    wb -= 1
    wc -= 1
    wd -= 1
#print(k)
#print(dot)
#print(sharp)
#print(wa, wb, wc, wd)

if C<D:
    for s in sharp[wa//2:wc//2]:
        if s>1:
            print("No")
            sys.exit()
    for s in sharp[wb//2:wd//2]:
        if s>1:
            print("No")
            sys.exit()
    print("Yes")
elif C>D:
    for s in sharp[wa//2:wc//2]:
        if s>1:
            print("No")
            sys.exit()
    for s in sharp[wb//2:wd//2]:
        if s>1:
            print("No")
            sys.exit()
    if C<B:
        print("Yes")
        sys.exit()
    elif C>B:
        l = 0
        for i, s in enumerate(sharp[0:wa//2:-1]):
            if s>2:
                l = wa//2-i
        r = len(dot)
        for i, s in enumerate(sharp[wc//2:]):
            if s>2:
                r = wc//2+i
        for d in dot[l:r+1]:
            if d>2:
                print("Yes")
                sys.exit()
        else:
            print("No")


# In[ ]:






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

# In[43]:


N, A, B, C, D = map(int, input().split())
S = input()
"""
7 1 3 7 6
.#..#..
"""


# In[55]:


if '##' in S[A-1:C] or '##' in S[B-1:D]:
    print('No')
else:
    if C<D: # ACBD or ABCD
        print('Yes')
    else: # ABDC
        if '...' in S[B-2:D+1]:
            print('Yes')
        else:
            print('No')




# In[ ]:






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

print(s[b-1:d])

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 c<d:
        print('Yes')
    else:
        if '...' in s[b-2:d+1]:
            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 = input()
flag1, flag2 = False, False
if d > c:
    print("OK1")
    flag = "##" not in s[b: d - 1] and "##" not in s[a: c - 1]
else:
    print("OK2")
    flag = "..." in s[b: d - 1]

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

n, a, b, c, d = map(int, input().split())
s = input()
flag1, flag2 = False, False
if d > c:
    print("OK1")
    flag = "##" not in s[b: d - 1] and "##" not in s[a: c - 1]
else:
    print("OK2")
    flag = "..." in s[b: d]

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

n, a, b, c, d = map(int, input().split())
s = input()
flag1, flag2 = False, False
if d > c
    flag = "##" not in s[b: d] and "##" not in s[a: c]
else:
    flag = "..." in s[b: d]

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

n, a, b, c, d = map(int, input().split())
s = input()
flag1, flag2 = False, False
if d > c:
    flag = "##" not in s[b: d] and "##" not in s[a: c]
else:
    flag = "..." in s[b - 2: d + 1]

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

Verdicts: Wrong Answer

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

for i in range(n-1):
    if s[i] == "#" and s[i+1] == "#":
        print("No")
        exit()
if d < c:
    for i in range(n-2):

        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            print("Yes")
            exit()

    print("No")
    exit()
else:
    print("No")


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

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

if d > c:
    for i in range(n-2):

        if s[i] == "." and s[i+1] == "." and s[i+2] == ".":
            print("Yes")
            exit()

    print("No")
    exit()
else:
    print("No")


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

if "##" in s[a:max(c,d)]:
    print("No")
elif 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):
S = input()
S = S.replace('BC', 'X')

ans = 0
acc_A = 0
for s in S:
    if s=='A':
        acc_A += 1
    elif s=='X':
        ans += acc_A
    else:
        acc_A = 0

print(ans)

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

S = input()
x = [0]

for s in S:
    if s == '#':
        x.append(1)
    else:
        x.append(0)

flag = 0

for i in range(a, c):
    if x[i] + x[i+1] == 2:
        flag = 1
for i in range(b, d):
    if x[i] + x[i+1] == 2:
        flag = 1

flag2 = 1

if c > d:
    for i in range(b-1, d):
        if x[i] + x[i+1] + x[i+2] == 0:
            flag2 = 0
else:
    flag2 = 0

if flag + flag2 == 0:
    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):
import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()



def solve():
    until = max(C,D)
    is_comma_suc3 = '...' in S[B - 1 : until]
    is_hash_suc3 = '
    if C < D:
        return "Yes" if not is_hash_suc3 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc3 else "No"

if __name__ == "__main__":
    print(solve())

import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()



def solve():
    until = max(C,D)
    is_comma_suc3 = '...' in S[A - 1 : until]
    is_hash_suc3 = '
    if C < D:
        return "Yes" if not is_hash_suc3 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc3 else "No"

if __name__ == "__main__":
    print(solve())

import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()



def solve():
    until = max(C,D)
    is_comma_suc3 = '...' in S[B : until]
    is_hash_suc3 = '
    if C < D:
        return "Yes" if not is_hash_suc3 else "No"
    else:
        return "Yes" if is_comma_suc3 and not is_hash_suc3 else "No"

if __name__ == "__main__":
    print(solve())

import sys

stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, A, B, C, D = read_int()
S = read_str()

def solve():
    can_reach = not ('##' in S[A:C] or '##' in S[B:D])
    is_comma_suc3 = '...' in S[B - 2 : D + 1]
    if C < D:
        return "Yes" if can_reach else "No"
    else:
        return "Yes" if is_comma_suc3 and can_reach else "No"

if __name__ == "__main__":
    print(solve())

Verdicts: Wrong Answer

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())
A-=1
B-=1
C-=1
D-=1
S=input()
s=[0]*N
stop=[0]*N
space=[0]*N
for i in range(N):
    if S[i]=='#':
        s[i]=1
        if i>0 and s[i-1]==1:
            stop[i]=1
    elif i>1 and s[i-1]==0 and s[i-2]==0:
        space[i]=1
    if i>0:
        stop[i]+=stop[i-1]
        space[i]+=space[i-1]
if stop[C]-stop[A]>0 or stop[D]-stop[B]>0:
    ans=0
elif C<D:
    ans=1
elif space[D+1]-space[B]>0:
    ans=1
else:
    ans=0
print(s,stop,space)
print(['No','Yes'][ans])

N,A,B,C,D=map(int, input().split())
A-=1
B-=1
C-=1
D-=1
S=input()
s=[0]*N
stop=[0]*N
space=[0]*N
for i in range(N):
    if S[i]=='#':
        s[i]=1
        if i>0 and s[i-1]==1:
            stop[i]=1
    elif i>1 and s[i-1]==0 and s[i-2]==0:
        space[i]=1
    if i>0:
        stop[i]+=stop[i-1]
        space[i]+=space[i-1]
if stop[C]-stop[A]>0 or stop[D]-stop[B]>0:
    ans=0
elif C<D:
    ans=1
elif space[D+1]-space[B]>0:
    ans=1
else:
    ans=0
print(['No','Yes'][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):
n, a, b, c, d = [int(i) for i in input().split()]
s = input()
res = "YES"
e = max(c,d)
if "##" in s[a-1:e-1]:
	res = "NO"
elif c > d:
	if "..." not in s[b-2:d+1]:
		res = "NO"
print(res)


n, a, b, c, d = [int(i) for i in input().split()]
s = input()
res = "YES"
e = max(c,d)
if "##" in s[a-1:e-1]:
	res = "NO"
elif c > d:
	print(s[b-2:d+1])
	if "..." not in s[b-2:d+1]:
		res = "NO"
print(res)

n, a, b, c, d = [int(i) for i in input().split()]
s = input()
res = "Yes"
e = max(c,d)
if "##" in s[a-1:e-1]:
	res = "No"
elif c > d:
	if "..." not in s[b-2:d+1]:
		res = "No"
print(res)

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):
S = input()

flag = 0
ans = 0
i = 0
S= list(S)


while flag == 0:
    if len(S) < 3+i:
        flag = 1
    elif S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
        S[i] = 'B'
        S[i+1] = 'C'
        S[i+2] = 'A'
        i=0
        ans+=1
    elif S[i]=="A":
        i+=1
    else:
        S.pop(i+1)
print(ans)





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


if A<B:
    low = A
    mid1 = B
else:
    low = B
    mid1 = A

if C<D:
    high = D
    mid2 = C
else:
    high = C
    mid2 = D



for i in range(low,high-1):
     if S[i]=="#" and S[i+1]:
         ans = 0
    

 
flag = 0
flag2 = 1
if D<C:
    flag2 = 0
    for i in range(B,D):
          if S[i]=="." and flag == 2:
              flag2 = 1
              flag = 0
          elif S[i] == ".":
              flag += 1
          else:
              flag = 0
if flag2 ==0:
    ans = 0


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


S = input()

flag = 0
ans = 0
i = 0
S= list(S)


while flag == 0:
    if len(S) < 3+i:
        flag = 1
    elif S[i]=="A" and S[i+1]=="B" and S[i+2]=="C":
        S[i] = 'B'
        S[i+1] = 'C'
        S[i+2] = 'A'
        i=0
        ans+=1
    elif S[i]=="A":
        i+=1
    else:
        S.pop(i+1)
print(ans)





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


if A<B:
    low = A
    mid1 = B
else:
    low = B
    mid1 = A

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

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


Verdicts: Wrong Answer

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 s[a-1:max(c,d)].count("##")>0:
    print("No")
elif c<d:
    print("No")


n,a,b,c,d=map(int,input().split())
s=input()
if s[:max(c,d)].count("##")>0:
    print("No")
elif c<d:
    print("Yes")
else:
    if s[b-1:d+1].count("...")=0:
        print("No")
    else:
        print("Yes")


n,a,b,c,d=map(int,input().split())
s=input()
if s[a-1:max(c,d)].count("##")>0:
    print("No")
elif c<d:
    print("Yes")
else:
    if s[b-2:d+1].count("...")!=0:
        print("Yes")
    else:
        print("No")


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


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


Verdicts: Wrong Answer

Accepted