TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
H = [int(i) for i in input().split()]
#  N = 5
#  H = [1, 2, 1, 1, 3]
#  N = 4
#  H = [1, 3, 2, 1]
#  N = 5
#  H = [1, 2, 3, 4, 5]
#  N = 1
#  H = [1000000000]
ret = True
prev = H[0]
peek = 0
for i in range(1, N - 1):
    peek = H[i + 1]
    h = H[i]
    if h > peek:
        h -= 1
    print(prev, H[i], h, peek)
    if h < prev:
        ret = False
        break
    prev = h
print("Yes" if ret else "No")


N = int(input())
H = [int(i) for i in input().split()]
ans = True
prev = -999
peek = 0
for i in range(N):
    h = H[i]
    if prev <= H[i] - 1:
        prev = H[i] - 1
    elif prev <= H[i]:
        prev = H[i]
    else:
        ans = False
        break
print("Yes" if ans else "No")


Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N=int(input())
List = list(map(int, input().split()))
flg = True
if N ==1: print("Yes")
else:
  for i in range(1,N):
    if List[i]>=List[i-1] or List[i]-1>=List[i-1]:
      pass
    else:
      flg=False
      break
  if flg:
    print("Yes")
  else:
    print("No")

N=int(input())
List = list(map(int, input().split()))
flg = True
if N ==1: print("Yes")
else:
  for i in range(1,N):
    if List[i]==List[i-1]:
      pass
    elif List[i]>List[i-1] or List[i]-1>=List[i-1]:
      List[i] = List[i]-1
    else:
      flg=False
      break
  if flg:
    print("Yes")
  else:
    print("No")

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n=int(input())
h=list(map(int,input().split()))
ans="Yes"
for i in range(n-1,0,-1):
  if h[i-1]<=h[i]:
    continue
  elif h[i-1]==h[i]+1:
    h[i-1]=h[i-1]-1
  else:n=int(input())
h=list(map(int,input().split()))
ans="Yes"
for i in range(n-1,0,-1):
  if h[i-1]<=h[i]:
    continue
  elif h[i-1]==h[i]+1:
    h[i-1]=h[i-1]-1
  else:
    ans="No"
    break
print(ans)

n=int(input())
h=map(int,input().split())
ans="Yes"
for i in range(n:0:-1):
  if h[i-1]<=h[i]:
    continue
  elif h[i-1]==h[i]+1:
    h[i-1]=h[i-1]-1
  else:
    ans="No"
    break
print(ans)
    
    


    n=int(input())
h=list(map(int,input().split()))
ans="Yes"
for i in range(n-1,0,-1):
  if h[i-1]<=h[i]:
    continue
  elif h[i-1]==h[i]+1:
    h[i-1]=h[i-1]-1
  else:n=int(input())
h=list(map(int,input().split()))
ans="Yes"
for i in range(n-1,0,-1):
  if h[i-1]<=h[i]:
    continue
  elif h[i-1]==h[i]+1:
    h[i-1]=h[i-1]-1
  else:
    ans="No"
    break
print(ans)
    ans="No"
    break
print(ans)

n=int(input())
h=list(map(int,input().split()))
ans="Yes"
for i in range(n-1,0,-1):
  if h[i-1]<=h[i]:
    continue
  elif h[i-1]==h[i]+1:
    h[i-1]=h[i-1]-1
  else:
    ans="No"
    break
print(ans)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):

N = int(input())
H = list(map(int, input().split()))

count = 0
diff = 0

if N == 1:
    print("Yes")
    exit(1)

for i in range(0, N-1):
    if H[i] <= H[i+1]:
        continue
    else:
        count += 1
        if diff < H[i+1] - H[i]:
            diff = H[i+1] - H[i]


if count <= 1 and diff <= 1:
    print("yes")
else:
    print("No")



N = int(input())
H = list(map(int, input().split()))

count = 0
diff = 0

if N == 1:
    print("Yes")
else:
    minn = 1
    tmp = 0
    for i in range (0, N):
        if minn <= H[i] - 1:
            H[i] -= 1
            minn = H[i]
        elif minn <= H[i]:
            minn = H[i]
        else:
            tmp = 1

    if tmp == 0:
        print("Yes")
    else:
        print("No")



Verdicts: Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n=int(input())
h=list(map(int,input().split()))
ans=0
for i in range(0,n-1):
  if h[i]>=h[i+1]+2:
    ans+=1
    break
  elif h[i]==h[i+1]+1:
    if ans=1:
      break
    else:
      ans+=1
  else:
    ans=0
if ans==0:
  print("Yes")
else:
  print("No")

n=int(input())
h=list(map(input().split()))
ans=0
for i in range(0,n-1):
    if h[i]<=h[i+1]:
        ans+=0
    elif h[i]>=h[i+1]+2:
        ans+=1
    else:
        if i<n-2:
            if h[i+1]<=h[i+2]:
                ans+=0
            else:
                ans+=1    
        else:
            ans+=0
        
if ans==0:
    print("Yes")
else:
    print("No")

n=int(input())
h=list(map(int,input().split()))
ans=0
for i in range(0,n-1):
  if h[i]<=h[i+1]:
    ans+=0
  elif h[i]>=h[i+1]+2:
    ans+=1
  else:
    if i<(n-2):
      if h[i+1]<=h[i+2]:
        ans+=0
      else:
        ans+=1    
    else:
      if n==2:
        ans+=0
      else:
        if h[i]=h[i-1]:
          ans+=1
        else:
          ans+=0
        
if ans==0:
    print("Yes")
else:
    print("No")


n=int(input())
h=list(map(input().split()))
ans=0
for i in range(0,n-1):
  if h[i]<=h[i+1]:
    ans+=0
  elif h[i]>=h[i+1]+2:
    ans+=1
  else:
    if i<n-2:
      if h[i+1]<=h[i+2]:
        ans+=0
      else:
        ans+=1    
    else:
      ans+=0
        
if ans==0:
    print("Yes")
else:
    print("No")


n=int(input())
h=list(map(int,input().split()))
max=h[0]
for i in range(n):
    if h[i]>max:
        max=h[i]-1
    elif h[i]<max:
        print("No")    
        exit()
print("Yes")        

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
h = list(map(int,input().split()))
h.insert(0,0)

flag = 0

for i in range(n):
  if h[i+1]>=h[i]:
    flag=1
  else:
    h[i+1] = h[i]-1
    if h[i+1]>=h[i]:
      flag=1
    else:
      print('No')
      flag=0
      break
if flag==1:
  print('Yes')

n = int(input())
h = list(map(int,input().split()))
l=len(h)
h.insert(0,0)

flag = 0

for i in range(l):
  if h[i+1]>=h[i]:
    flag=1
  else:
    h[i+1] = h[i]-1
    if h[i+1]>=h[i]:
      flag=1
    else:
      print('No')
      flag=0
      break
if flag==1:
  print('Yes')

import sys

N = int(input())
H = list(map(int,input().split()))

for i in range(N-1):
    if H[i+1] == H[i]:
        None
    elif H[i+1] > H[i]:
        H[i+1] = H[i+1]-1
    else:
        print('No')
        sys.exit()
print('Yes')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
import sys

n = int(input())
h = list(map(int, input().split()))

for i in range(n):
    d = h[i+1] - h[i]
    if d >= 1:
        h[i+1] -= 1
    elif d < 0:
        print('No')
        sys.exit()
print('Yes')


import sys

n = int(input())
h = list(map(int, input().split()))

for i in range(n-1):
    d = h[i+1] - h[i]
    if d >= 1:
        h[i+1] -= 1
    elif d < 0:
        print('No')
        sys.exit()
print('Yes')

Verdicts: Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
a = list(map(int,input().split()))
num = 0
for i in a:
    print(num)
    if i - num > 0:
        num = i-1
    elif i - num == 0:
        num = i
    elif i - num < 0:
        print("No")
        exit()
print("Yes")

N = int(input())
a = list(map(int,input().split()))
num = 0
for i in a:
    if i - num > 0:
        num = i-1
    elif i - num == 0:
        num = i
    elif i - num < 0:
        print("No")
        exit()
print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
h = list(map(int, input().split()))
for i in range(n-1):
	if h[i+1]-h[i] < 0:
		h[i] = h[i+1]
for i in range(n-1):
	if h[i+1]-h[i] <= 0:
		print ("No")
		exit()
print ("Yes")

n = int(input())
h = list(map(int, input().split()))
prev = -1
for i in range(n):
	if prev <= h[i]-1:
		prev = h[i]-1
	elif prev <= h[i]:
		prev = h[i]
	else:
		print ("No")
		exit()
print ("Yes")


Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
import sys
n = int(input())
h = list(map(int, input().split()))

if n==1:
  print("Yes")
  sys.exit(0)
elif n==2:
  if h[0]-1 > h[1]:
    print("No")
  else:
    print("Yes")
  sys.exit(0)

diff = [h[i+1]-h[i] for i in range(n-1)]
chain_nega = [1 if (diff[i+1]<0 and diff[i]<0) else 0 for i in range(n-2)] 

print(diff)
print(chain_nega)

if min(diff) < -1:
  print("No")
elif sum(chain_nega)>0:
  print("No")
else:
  print("Yes")


import sys
n = int(input())
h = list(map(int, input().split()))

if n==1:
  print("Yes")
  sys.exit(0)
elif n==2:
  if h[0]-1 > h[1]:
    print("No")
  else:
    print("Yes")
  sys.exit(0)

diff = [h[i+1]-h[i] for i in range(n-1)]


flag = False

for d in diff:
  if d<0:
    if flag==True:
      print("No")
      sys.exit(0)
    else:
      flag=True
  elif d>0:
    flag=False
    
#print(diff)

if min(diff) < -1:
  print("No")
else:
  print("Yes")


Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
def main():
  import sys
  input()
  j=1
  k=False
  for i in map(int,sys.stdin.readline().split()):
    if i>j:
      k=True
      j=i
    elif j==i+1:
      k=False
    else:
      if k==True and j-i==1:
        k=False
      else:
        print("No")
        exit()
    
  print("Yes")
  
if __name__=="__main__":
  main()
  

def main():
  import sys
  n=int(input())
  h=map(int,sys.stdin.readline().split())
  g=list(h)[::-1]
  j=g[0]
  for i in g:
    if i>j+1:
      print("No")
      exit()
    elif i==j+1:
      pass
    else:
      j=i
  print("Yes")
  
if __name__=="__main__":
  main()

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
H = input().split()
cnt = 0

for i in range(N-1):
    if (int(H[i]) > int(H[i+1])-1):
        cnt += 1

if (cnt != 0):
    print("No")
else:
    print("Yes")

N = int(input())
H = input().split()
cnt = 0

for i in range(N-1):
    if (int(H[i]) >= int(H[i+1])-1):
        cnt += 1

if (cnt != 0):
    print("No")
else:
    print("Yes")
    

N = int(input())
H = input().split()
cnt = 0

for i in range(N-1):
    if (int(H[i+1]) > int(H[i])):
        H[i+1] = int(H[i+1])-1
    if (int(H[i]) > int(H[i+1])):
        cnt += 1

if (cnt != 0):
    print("No")
else:
    print("Yes")


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
h =list(map(int, input().split()))

if n==1:
    print('Yes')
    exit(0)
if n==2:
    if h[0] >= h[1]-1:
        print('Yes')
        exit(0)
    else:
        print('No')
        exit(0)

h[0] -=1

for i in range(1, n-1):
    if h[i-1] == h[i] and h[i] <=h[i+1]:
        continue
    elif h[i-1] == h[i] and h[i] >h[i+1]:
        print('No')
        exit(0)

    elif h[i] >= h [i+1]:
        h[i] -= 1
    elif h[i] > h [i+1]+1:
        print('No')
        exit(0)

if h[-2] >= h[-1]:
    print('Yes')
    exit(0)
else:
    print('No')
    exit(0)

n = int(input())
h =list(map(int, input().split()))

if n==1:
    print('Yes')
    exit(0)
if n==2:
    if h[0] >= h[1]-1:
        print('Yes')
        exit(0)
    else:
        print('No')
        exit(0)

h[0] -=1

for i in range(1, n-1):
    if h[i-1] == h[i] and h[i] <=h[i+1]:
        continue
    elif h[i-1] == h[i] and h[i] >h[i+1]:
        print('No')
        exit(0)

    elif h[i] <= h [i+1]+1:
        h[i] -= 1
    elif h[i] > h [i+1]+1:
        print('No')
        exit(0)


print('Yes')

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())

H = list(map(int, input().split()))

for i in range(N):
    if i == 0:
        H[i] -= 1
        continue

    if i == N - 1:
        if H[i] < H[i - 1]:
            print('No')
            exit()
        else:
            break

    if H[i + 1] - H[i] <= 0:
        H[i] -= 1

        if H[i] < H[i - 1]:
            print('No')
            exit()

print('Yes')


N = int(input())

H = list(map(int, input().split()))

for i in range(N):
    if i == 0:
        H[i] -= 1
        continue

    if i == N - 1:
        if H[i] < H[i - 1]:
            print('No')
            exit()
        else:
            break

    if H[i + 1] - H[i] <= -2:
        print('No')
        exit()

    if H[i + 1] - H[i] <= 0:
        if H[i] > H[i - 1]:
            H[i] -= 1
    elif H[i] < H[i + 1]:
        H[i] -= 1

    if H[i] < H[i - 1]:
        print('No')
        exit()

print('Yes')

N = int(input())

H = list(map(int, input().split()))

for i in range(N):
    if i == 0:
        H[i] -= 1
        continue

    if i == N - 1:
        if H[i] < H[i - 1]:
            print('No')
            exit()
        else:
            break

    if H[i + 1] - H[i] <= -2:
        print('No')
        exit()

    if H[i + 1] - H[i] <= 0:
        if H[i] > H[i - 1]:
            H[i] -= 1
    elif H[i] < H[i + 1] and H[i - 1] < H[i]:
        H[i] -= 1

    if H[i] < H[i - 1]:
        print('No')
        exit()

print('Yes')


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
*h, = map(int, input().split())

success = True
for i in range(1, n):
    if 1 < h[i] - h[i-1]:
        success = False
        break

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

n = int(input())
*h, = map(int, input().split())

success = True
m = -1
for i in range(n):
    m = max(m, h[i])
    if m - 1 > h[i]:
        success = False
        break

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

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
H = list(map(int,input().split()))

i = 0
ans = "Yes"
while(i < N-1):
    if H[i+1]>H[i]-1:
        ans = "No"
    i += 1
print(ans)

n = int(input())
H = list(map(int,input().split()))
H[0] -= 1
ans = "Yes"
for i in range(1,n):
    if H[i] < H[i-1]:
        ans = "No"
        break
    if H[i]-1 >= H[i-1]:
        H[i]-=1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
H = list(map(int, input().split()))  
H = list(reversed(H))  
if N==1:
    ans='Yes'
else:         
    for i in range(1, N):
        if H[i] - H[i-1] >= 2: #
            ans='No'
            break   
        elif H[i] - H[i-1] == 1: # 1 smaller
            H[i] -= 1
print(ans)  

N = int(input())
H = list(map(int, input().split()))  
H = list(reversed(H))

ans='yes'
for i in range(N-1):
    if  H[i] >= H[i+1]:
        continue
    if H[i] - H[i+1] == -1: 
        H[i+1] -= 1
        continue
    ans='no'
    break
    
print(ans)

N = int(input())
H = list(map(int, input().split()))  

H = list(reversed(H)) 
ans='Yes'
if N==1:
    ans='Yes'
else:         
    for i in range(1, N):
        if H[i] - H[i-1] >= 2: #
            ans='No'
            break   
        elif H[i] - H[i-1] == 1: # 1 smaller
            H[i] -= 1
print(ans)   

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N=int(input())
H = list(map(int,input().split( )))
i = 1
s = 0

while i < N:
    if H[i-1] + 1 < H[i]:
        s = 1
        break
    if H[i-1] - 1 > H[i]:
        s = 1
        break
    i = i+1

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


N=int(input())
H = list(map(int,input().split( )))
i = 1
s = 0

while i < N:
    if H[i-1] + 1 < H[i]:
        s = 1
        break
    i = i+1

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


N=int(input())
H = list(map(int,input().split( )))
i = 1
s = 0
max = 0

while i < N + 1:
    if max - 1 > H[i-1]:
        s = 1
        break
    if max < H[i-1]:
        max = H[i-1]
    i = i+1

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


Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(inut())
h = list(map(int, input().split()))
t = 0
for i in range(n - 2):
    if h[i] - h[i+1] >= 2:
        print("No")
        t = 1
        break
    elif i <= n - 4:
        if h[i] - h[i+1] == 1 and h[i+1] - h[i+2] == 1:
            print("No")
            t = 1
            break
if t == 0:
    print("Yes")


n = int(inut())
h = list(map(int, input().split()))
t = 0
for i in range(n - 2):
    if h[i] - h[i+1] >= 2:
        print("No")
        t = 1
        break
    elif i <= n - 3:
        if h[i] - h[i+1] == 1 and h[i+1] - h[i+2] == 1:
            print("No")
            t = 1
            break
if t == 0:
    print("Yes")

n = int(input())
h = list(map(int, input().split()))
t = 0
m = 0
for i in range(n):
    if h[i] > t:
        t = h[i]
    elif t - h[i] >= 2:
        print("No")
        m += 1
        break
if m == 0:
    print("Yes")

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
h = list(map(int, input().split(" ")))
a = 'Yes'
m = max(h)
for i in range(1, len(h)):
    if h[i] < h[i-1] and m - h[i] > 1:
        a = 'No'
        break
print(a)


n = int(input())
h = list(map(int, input().split(" ")))
a = 'Yes'
m = 0
for i in range(1, len(h)):
    m = max(h[i], m)
    if h[i] < h[i-1] and m - h[i] > 1:
        a = 'No'
        break
print(a)


Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
li = list(map(int,input().split()))
ans = "Yes"

if n == 1:
    print(ans)
else:
    for i in range(n):
        if li[i] + 1 <= max(li[:i+1]):
            ans = "No"
            break

print(ans)

n = int(input())
li = list(map(int,input().split()))
ans = "Yes"
max_n = 0

if n == 1:
    print(ans)
else:
    for i in li:
        if i < max_n - 1:
            ans = "No"
            break
        max_n = max(i,max_n)

n = int(input())
li = list(map(int,input().split()))
ans = "Yes"
max_n = 0

if n == 1:
    print(ans)
else:
    for i in li:
        if i + 1 <= max_n :
            ans = "No"
            break
        else:
            max_n = max(i,max_n)
print(ans)

n = int(input())
li = list(map(int,input().split()))
ans = "Yes"
max_n = 0


for i in li:
    if i < max_n - 1:
        ans = "No"
        break
    max_n = max(i,max_n)
print(ans)

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
H = list(map(int,input().split()))
ans ="Yes"
for i in range(N-1):
    if H[i+1]-H[i]>1:
        ans ="No"
        break

print(ans)

N = int(input())
H = list(map(int,input().split()))
ans ="Yes"
highest = H[0]
for i in range(N-1):
    if H[i+1]<highest-1:
        ans ="No"
        break
    highest = max(highest,H[i+1])

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
H = list(map(int, input().split()))
ans = True
lis = {}
for i in H:
  if i in lis:
    lis[i] += 1
  else:
    lis[i] = 1
mine = min(H)
times = lis[mine]
for i in range(N):
  if mine < H[i]-1:
    ans = False
    break
  else:
    if H[i] == mine:
      times -= 1
    if times == 0 and i != N-1:
      del lis[mine]
      lis = sorted(lis)
      mine = next(iter(lis))
      times = lis[next(iter(lis))]
if ans:
  print("Yes")
else:
  print("No")

N = int(input())
A = list(map(int, input().split()))
A.reverse()
ans = "Yes"
for i in range(N-1):
  if A[i] >= A[i+1]:
    continue
  elif A[i] == A[i+1] - 1:
    A[i+1] = A[i]
  else:
    ans = "No"
print(ans)

Verdicts: Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
A = list(map(int, input().split()))
if N == 1:
    print("Yes")
else:
    k = 0
    for i in range(N -1):
        if (A[i] - A[i+1]) >= 2:
            k  += 1
    q = 0
    for j in range(N-1):
        if (A[0] - A[j+1]) >= 2:
            q += 1
    y = 0
    for x in range(N-1):
        if (A[i] - A[i+1]) >= 1 :
            y  += 1
    if k < 1 and q == 0 and y >= 1:
        print("Yes")
    else:
        print("No")

N = int(input())
A = list(map(int, input().split()))
if N == 1:
    print("Yes")
else:
    k = 0
    for i in range(N -1):
        if (A[i] - A[i+1]) >= 2:
            k  += 1
    if k < 1 and (A[N-1] - A[i]) <=1:
        print("Yes")
    else:
        print("No")

N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(N-1):
  if ans > A[i+1]:
    print('No')
    exit()
  if A[i+1]-A[i] >= -1:
    ans = max(A[i+1]-1,A[i]-1,ans)
    if A[i+1] >= A[i] and A[i+1] > ans :
      A[i+1] -=1
  else:
    print('No')
    exit()
print('Yes')

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
H = list(map(int,input().split()))
ans = "Yes"
for i in range(1,N):
    if H[i] > H[i+1] + 1:
        ans = "No"
        break
print(ans)


N = int(input())
H = list(map(int,input().split()))
ans = "Yes"
for i in range(N-1):
    if H[i] > H[i+1] - 1:
        ans = "No"
        break
if max(H) > H[N-1] + 1:
    ans = "No"
print(ans)


N = int(input())
H = list(map(int,input().split()))
for i in range(N-2,0,-1):
 if H[i]> H[i+1]:
   H[i] -=1
   if H[i] > H[i+1]:
     print('No')
     break
else:
 print('Yes')


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
@patch('builtins.input', test.test_input)
def main():
    n = int(input())
    h = list(map(int, input().split()))
    
    pre = h[0]
    for hh in h:
        if hh < pre:
            if hh >= pre - 1:
                pre = hh
            else:
                print('No')
                return
        pre = hh
        
    print('Yes')
    
if __name__ == '__main__':
    main()

def main():
    n = int(input())
    h = list(map(int, input().split()))
    
    pre = h[0]
    for hh in h:
        if hh < pre-1:
            print('No')
            return
        pre = max(pre, hh)
        
    print('Yes')
    
if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n=int(input())
h=list(map(int,input().split()))
for i in range(n):
  if h[i+1]>h[i]+1:
    print('No')
    exit()
print('Yes')
    

n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
h_.append(h[n-1])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if h[i+1]<h[i]:
    cnt=1
if cnt==1:
  if min(h)=<max(h)=<1+min(h):
    print('Yes')
  else:
    print('No')
else:
  print('Yes')


n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
h_.append(h[i])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n):
  if h[i+1]>h[i]+1:
    cnt=1
if cnt==0:
  print('Yes')
else:
  print('No')
    


n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
for i in range(n-1):
  if l[i]>l[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n-1):
  if h[i+1]>h[i]+1:
    cnt=1
if cnt==0:
  print('Yes')
else:
  print('No')

n=int(input())
h=list(map(int,input().split()))
cnt=0
for i in range(n):
  if h[i+1]<h[i]:
    cnt=1
if cnt==1:
  if min(h)=<max(h)=<1+min(h):
    print('Yes')
  else:
    print('No')
else:
  print('Yes')

n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n=int(input())
h=list(map(int,input().split(" ")))
m=0
a=False
for i in h:
    if i<m+1:
        a=True
    if i>m:
        m=i
print('YNeos'[a::2])

n=int(input())
h=list(map(int,input().split(" ")))
m=h[0]
a=False
for i in h:
    if i+1<m:
        a=True
    if i>m:
        m=i
print('YNeos'[a::2])


Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
H = list(map(int,input().split()))

for i in range(1,N):
    ind = N - i - 1
    print(ind)
    if H[ind+1] == H[ind] - 1:
        H[ind] -= 1
    elif H[ind+1] < H[ind] - 1:
        print("No")
        exit()
print("Yes")


N = int(input())
H = list(map(int,input().split()))

for i in range(1,N):
    ind = N - i - 1
    if H[ind+1] == H[ind] - 1:
        H[ind] -= 1
    elif H[ind+1] < H[ind] - 1:
        print("No")
        exit()
print("Yes")


Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
hs = list(map(int, input().split()))

if n == 1:
    print("Yes")
    exit()

for i in range(n-1):
    if hs[i-1] >= hs[i]:
        hs[i-1] -= 1

flag = True
for i in range(1,n):
    if hs[i-1] > hs[i]:
        flag = False
if flag:
    print("Yes")
else:
    print("No")


n = int(input())
hs = list(map(int, input().split()))

if n == 1:
    print("Yes")
    exit()
hs[0] -= 1
for i in range(n-1):
    if hs[i] > hs[i+1]:
        hs[i+1] -= 1

flag = True
for i in range(n-1):
    if hs[i] > hs[i+1]:
        flag = False
if flag:
    print("Yes")
else:
    print("No")


n = int(input())
hs = list(map(int, input().split()))

if n == 1:
    print("Yes")
    exit()

for i in range(n-1):
    if hs[i] > hs[i+1]:
        if hs[i] - hs[i+1] == 1:
            print("No")
            exit()

print("Yes")


n = int(input())
hs = list(map(int, input().split()))

if n == 1:
    print("Yes")
    exit()

for i in range(n-1):
    if hs[i] >= hs[i+1]:
        hs[i] -= 1

flag = True
for i in range(n-1):
    if hs[i] > hs[i+1]:
        flag = False
if flag:
    print("Yes")
else:
    print("No")


n = int(input())
hs = list(map(int, input().split()))

if n == 1:
    print("Yes")
    exit()

hs[0] -= 1
for i in range(n-1):
    if hs[i] < hs[i+1]:
        hs[i+1] -=1
    elif hs[i] > hs[i+1]:
        print("No")
        exit()

print("Yes")

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
# -*- coding:utf8 -*-

n = int(input())
h = list(map(int, input().split()))
ans = 'Yes'
p, pp = 0, 0
for i in h:
    if p == 0:
        p = i
    d =  p - i
    if d < -1 or (d == -1 and pp == -1):
        ans  'No'
        break
    else:
        pp = p
        p = d
print(ans)

# -*- coding:utf8 -*-

n = int(input())
h = list(map(int, input().split()))
ans = 'Yes'
p, pp = 0, 0
for k, i in enumerate(h):
    d =  p - i
    if k == 0:
        p = i
    elif d < -1 or (d == -1 and pp == -1):
        ans = 'No'
        break
    else:
        pp = p
        p = d
print(ans)

# -*- coding:utf8 -*-

n = int(input())
h = list(map(int, input().split()))
p = h[0]
l = [p]
for i in range(1,n):
    c = h[i]
    if i == 1 and p - 1 == c:
        l[0] == c
    if p < c:
        C -= 1
    l.append(c)
    p = c
ans = 'Yes' if l == sorted(l) else 'No'
print(ans)

# -*- coding:utf8 -*-

n = int(input())
h = list(map(int, input().split()))
ans = 'Yes'
t = h[0]
for i in h[1:]:
    if t + 1 < i or t > i + 1:
        ans = 'No'
        break
    else:
        t = i
print(ans)

# -*- coding:utf8 -*-

n = int(input())
h = list(map(int, input().split()))
ans = 'Yes'
t = h[0]
a = 0
for n in h[1:]:
    d = t - n
    if d < -1 or (d == -1 and a == -1):
        ans  'No'
        break
    else:
        t = i
        a = d
print(ans)

# -*- coding:utf8 -*-

n = int(input())
h = list(map(int, input().split()))
ans = 'Yes'
t = h[0]
for i in h[1:]:
    if t + 1 < i:
        ans = 'No'
        break
    else:
        t = i
print(ans)

# -*- coding:utf8 -*-

n = int(input())
h = list(map(int, input().split()))
ans = 'Yes'
t = h[0]
for i in h[1:]:
    if t + 1 < i or t > i:
        ans = 'No'
        break
    else:
        t = i
print(ans)

# -*- coding:utf8 -*-

n = int(input())
h = list(map(int, input().split()))
p = h[0]
l = [p]
for i in range(1,n):
    c = h[i]
    if i == 1 and p - 1 == c:
        l[0] == c
    if p < c:
        c -= 1
    l.append(c)
    p = c
ans = 'Yes' if l == sorted(l) else 'No'
print(ans)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
N = int(input())
li = list(map(int,input().split()))

for i in range(N-1):
  if li[i+1] >= li[i]+2:
    print("No")
    sys.exit()
    
  elif li[i+1] == li[i]+1:
    li[i+1] = li[i]
    
  else: continue
    
print("Yes")

import sys

N = int(input())
li = list(map(int,input().split()))
li.reverse()

for i in range(N-1):
  if li[i+1] >= li[i]+2:
    print("No")
    sys.exit()
    
  elif li[i+1] == li[i]+1:
    li[i+1] = li[i]
    
  else: continue
    
print("Yes")

Verdicts: Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n=int(input())
i= list(map(int, input().split()))
flag=0
if n==1:
    pass
else:
    for j in range(n-1):
        if i[j+1]>=i[j]:
           pass
        elif i[j]-1==i[j+1]:
           if flag==0:
               flag=2
           elif flag==2:
                flag=1
                break
if flag==0:
    print("Yes")
elif flag==1:
    print("No")
    

n=int(input())
i= list(map(int, input().split()))
flag=0
lis=[0]*n
for j in range(n-1):
    if i[j+1]>=i[j]+1:
        i[j+1]-=1
    elif i[j+1]<i[j]:
        flag=1
        break
if flag==0:
    print("Yes")
elif flag==1:
    print("No")
    

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n=int(input())
list=list(map(int,input().split()))
for i in range(1,n-2):
    if (list[i-1]+list[i+1])//2<=list[i]<=(list[i-1]+list[i+1])//2+1:
        continue
    else:
        print("No")
        break
else:
    if list[n-1]>=list[n-2]:
        print("yes")
    else:
        print("No")

n=int(input())
list=list(map(int,input().split()))
temp=0
for i in list:
    if temp>i:
        print("No")
        break
    else:
        temp=max(temp,i-1)
else:
    print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
h = list(map(int,input().split()))

for i in range(len(h)-1):
  if h[i] >= h[i+1]:
    h[i] = h[i] - 1
if h == sorted(h):
  print('Yes')
else:
  print('No')

n = int(input())
h = list(map(int, input().split()))

for i in reversed(range(1,n)):
  if h[i-1] - h[i] == 1:
    h[i-1] -= 1
  elif h[i-1] - h[i] > 1:
    print('No')
    exit()
print('Yes')

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
i = list(map(int, input().split()))

f = 1
for k in range(1, n):
  if f == 0:
    continue
  
  if k == 0:
    continue
  
  if i[k-1] < i[k]:
    i[k] = i[k] - 1
  elif i[k-1] - 1 == i[k]:
    i[k] = i[k]
  else:
    f = 0
      
if f == 0:
  print('No')
else:
  print('Yes')

str = list(input())
nn = len(str)
ss = [1] * nn

mm = pow(10, 2)
for i in range(1, mm):
  for j in range(1, nn):
    if ss[j-1] != 0:
      if str[j-1] == 'L':
        ss[j-1] = ss[j-1] - 1
        ss[j-2] = ss[j-2] + 1
      else:
        ss[j-1] = ss[j-1] - 1
        ss[j] = ss[j] + 1

kk = ' '.join(ss)
  
print(kk)

n = int(input())
i = list(map(int, input().split()))

f = 1
for k in range(1, n):
  if f == 0:
    continue
  
  if k == 0:
    continue
  
  if i[k-1] < i[k]:
    i[k] = i[k] - 1
  elif i[k-1] == i[k]:
    i[k] = i[k]
  else:
    f = 0
      
if f == 0:
  print('No')
else:
  print('Yes')

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
h = list(map(int, input().split()))

last = h[-1]
p = 'Yes'
t = h[0]
for i in h:
  if i > last + 1 or t > i:
    p = 'No'
  t = i
print(p)


n = int(input())
h = list(map(int, input().split()))[::-1]

for i in range(1,n):
  if h[i] - h[i-1] > 1:
    print("No")
    exit()
  elif h[i] - h[i-1] == 1:
    h[i] -= 1
print("Yes")

Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
n = int(input())
h_ls = list(map(int, input().split()))

target = [0]
for i in range(1,n):
    d = h_ls[i] - h_ls[i-1]
    if d > 0:
        target = []
    if d == 0:
        target.append(i)
    if d < 0:
        for j in target:
            h_ls[j] -= 1
res = 'Yes'
for i in range(1,n):
    d = h_ls[i] - h_ls[i-1]
    if d < 0:
        res = 'No'
print(res)

n = int(input())
h_ls = list(map(int, input().split()))

target = []
for i in range(1,n):
    d = h_ls[i] - h_ls[i-1]
    if d > 0:
        target = []
    elif d == 0:
        target.append(i-1)
    else:
        target.append(i-1)
        for j in target:
            h_ls[j] -= 1
        target = []
res = 'Yes'
for i in range(1,n):
    d = h_ls[i] - h_ls[i-1]
    if d < 0:
        res = 'No'
print(res)


Verdicts: Wrong Answer

Accepted
Problem: There are N squares arranged in a row from left to right. The height of the i-th square from the left is H_i.  For each square, you will perform either of the following operations once:    * Decrease the height of the square by 1.   * Do nothing.  Determine if it is possible to perform the operations so that the heights of the squares are non-decreasing from left to right.

Submission attempts (in order):
a=int(input())
h=list(map(int,input().split()))
m=0
r=True
for i in h:
  m=max(m,i)
  if m!=i:
    r=i+1=<m
print("NYoe s"[r::2])


a=int(input())
h=list(map(int,input().split()))
m=0
r=True
for  i in h:
  m=max(m,i)
  if m!=i:
    r=i+1==m
print(r)

input()
h=list(map(int,input().split()))
m=0
r=True
for i in h:
  r=i>=m-1
  if not(r):
    break
  m=max(m,i)
print("NYoe s"[r::2])

Verdicts: Runtime Error

Wrong Answer

Accepted