Last time It was hard because I couldn't do ABC160, so I gave up and wrote it here. I'm tired so I'll write it very loosely. I'm sorry #19 Problem
** Thoughts ** When comparing the relationship between h [i] and h [i-1], h [i] must be larger or the same for monotonous non-decrease. This time, the height of the square can be -1. If it is -1, the truth of the checker is changed.
n = int(input())
h = list(map(int,input().split()))
seed = h[0]
checker = True
for i in range(1,n):
if h[i] == h[i-1]:
continue
d = h[i] - h[i-1] + 1
if d > 0:
checker = True
pass
elif d == 0:
if checker:
checker = False
else:
print('No')
quit()
else:
print('No')
quit()
print('Yes')
Never enter a contest when you are tired or sleepy !!. see you
Recommended Posts