← Back to List

21965번: 드높은 남산 위에 우뚝 선 ↗

Solutions

Python 3
277 B | 277 chars
n = int(input())
l = [*map(int,input().split())]

chk = True
ans = True

if len(l) <= 1:
  ans = True

for i in range(1, len(l)):
  if l[i-1] == l[i]:
    ans = False
  elif l[i-1] < l[i]:
    if not chk:
      ans = False
  else:
    chk = False

print("YES" if ans else "NO")