Source Code
def solve(arr,x):
    if x == 1:
        return "YES"
    for i in (0,x-2):
        if(arr[i+1]<arr[i]):
            return "NO"
        
    return "YES"

T = int(input())

arr = [int(x) for x in input().split()]

print(solve(arr,T))
    
Copy
Anton Can't See (⊙︿⊙)_/¯ misterRoshi22
Python 3
39 ms
15.0 MB
Wrong Answer