Source Code

n = int(input())
tmp = input()
k = tmp.split(" ")
cond = True

for i in range(0, n - 1):
    if (int(k[i]) > int(k[i+1]) and cond):
        print("NO")
        
        cond = False
if (cond):
    print("YES")
Copy
AZOZ with an O (Needs a Carry) SilverCryptor
Python 3
19 ms
2.7 MB
Wrong Answer