问题描述:
Write a python function to check whether the count of inversion of two types are same or not.

测试用例:
['assert solve([1,0,2],3) == True', 'assert solve([1,2,0],3) == False', 'assert solve([1,2,1],3) == True']

生成的代码:
def solve(arr, n):
    # 计算第一种类型的逆序对
    count_type1 = sum(1 for i in range(len(arr)) for j in range(i + 1, len(arr)) if arr[i] > arr[j])
    
    # 计算第二种类型的逆序对
    count_type2 = sum(1 for i in range(len(arr)) for j in range(i + 1, len(arr)) if arr[i] == n and arr[j] < n)
    
    # 比较两种逆序对数量
    return count_type1 == count_type2