【参考程序】
#include<bits/stdc++.h>
using namespace std;
const int Maxn = 0x3f3f3f3f;
const int N =55;
int f[N][N][N][N],W[N],b[N],g[N][N];
int n,A,B,m;
template <class T>
inline void CkMin(T &X, T y) {if (x>y)x=y;}
int main()
{
memset(f,Maxn,sizeof(f));
memset(g,Maxn,sizeof(g));
scanf("%d%d%d",&n,&A,&B);
for(int i=1;i<=n;i++)
scanf("%d",&w[i]),b[++m]=w[i];
sort(b+1,b+m+1);
m=unique(b+1,b+m+1)-b-1;
for(int i=1;i<=n;i++
w[i]=lower_bound(b+1,b+m+1,w[i])-b;
for(int i=1;i<=n;i++)
{
g[i][i] = A;
for(int j=1;j<=w[i];j++
for(int k=w[i];k<=m;k++
f[i][i][j][k]=0;
}
for(int len=2;len<=n;len++
for(int i=1,j=i+len-1,j<=n;i++
{
for(int l=1;l<=m;l++)
for(int r=l;r<=m;r++)
for(int mid=i;mid<j;mid++)
{
}
for(int l=1;l<=m;l++)
for(int r=1;r<=m;r++)
}
print("%d\",g[i][n])
}