class Solution:
    def isMonotonic(self, A):
        """
        :type A: List[int]
        :rtype: bool
        """
        n=len(A)
        index1,index2=0,0
        for i in range(1,n):
            if A[i]>=A[i-1]:
                continue
            else:
                index1=1
        for i in range(1,n):
            if A[i]<=A[i-1]:
                continue
            else:
                index2=1
        if index1 and index2:
            return False
        return True
s=Solution()
A = [1,2,5]
print(s.isMonotonic(A))
# 如果没有set这一步 time limited error



