dp[l][r][0/1]已排好l,r;最后一个排的是l/r;
转移:
dp[i][j][0]=dp[i+1][j][0]*(a[i]<a[i+1])+dp[i+1][j][1]*(a[i]<a[j]) dp[i][j][1]=dp[i][j+1][0]*(a[j]>a[i])+dp[i][j-1][1]*(a[j]>a[j-1])