python-algorithm

백준 4589 Gnome Sequencing

무적김두칠 2022. 8. 2. 11:38

1
2
3
4
5
6
7
8
9
10
11
12
def sol(nums):
    ans =False
    if nums==sorted(nums) or nums==sorted(nums,reverse=True) :
        ans=True
    return ans
print("Gnomes:")
for i in range(int(input())):
    nums=list(map(int,input().split()))
    if sol(nums)== True:
        print("Ordered")
    else :
        print("Unordered")
cs
반응형