Language: C++

#include <algorithm>
// #include <cstdlib>
#include <cstring>
#include <cstdio>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
typedef long long LL;
typedef double db;
const int oo=2139063143;
const int N=1010000;
const int P=1000000007;
const db eps=1e-7;
#define pritnf printf
//char buf[1<<22],*p1=buf,*p2=buf,obuf[1<<22],*O=obuf;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
template <typename T>
inline void sc (T &x)
{
    x=0; static int p; p=1; static char c; c=getchar();
    while (!isdigit(c)) { if (c=='-') p=-1; c=getchar(); }
    while ( isdigit(c)) { x=(x<<1)+(x<<3)+(c-48); c=getchar(); }
    x*=p;
}
template <typename T>
inline void print (T x)
{
    if (x< 0) putchar('-'),x=-x;
    if (x>=10) print(x/10);
    putchar(x%10+'0');
}
template <typename T>
inline void pr (T x) { print(x),putchar('\n'); }
template <typename T1,typename T2>
void chkmax (T1 &A,T2 B) { A=A>=B?A:B; }
template <typename T1,typename T2>
void chkmin (T1 &A,T2 B) { A=A<=B?A:B; }
int n,A,B;
LL f[N][N];

int main ()
{
    // freopen (".in","r",stdin);
    // freopen (".out","w",stdout);
	sc(n),sc(A),sc(B);
	for (int i=1; i<=n; i++)
	{
		int x; sc(x);
		memset (f[i],127,sizeof (LL)*(n+1));
		for (int j=0; j<=n; j++)
		{
			if (x< j) f[i][j]=f[i-1][j]+B;
			else if (x> j) f[i][j]=f[i-1][j]+A;
		}
		for (int j=0; j<=x; j++)
			chkmin (f[i][x],f[i-1][j]);
	}
	LL ans=1e18;
	for (int i=0; i<=n; i++)
		chkmin (ans,f[n][i]);
	pr(ans);

    return 0;
}


Compiler output:
/tmp/cc4SlfwT.o: in function `void sc<int>(int&)':
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x18): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::p' defined in .bss._ZZ2scIiEvRT_E1p[_ZZ2scIiEvRT_E1p] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::c' defined in .bss._ZZ2scIiEvRT_E1c[_ZZ2scIiEvRT_E1c] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x30): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::c' defined in .bss._ZZ2scIiEvRT_E1c[_ZZ2scIiEvRT_E1c] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x3a): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::p' defined in .bss._ZZ2scIiEvRT_E1p[_ZZ2scIiEvRT_E1p] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x49): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::c' defined in .bss._ZZ2scIiEvRT_E1c[_ZZ2scIiEvRT_E1c] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x50): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::c' defined in .bss._ZZ2scIiEvRT_E1c[_ZZ2scIiEvRT_E1c] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x78): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::c' defined in .bss._ZZ2scIiEvRT_E1c[_ZZ2scIiEvRT_E1c] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x91): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::c' defined in .bss._ZZ2scIiEvRT_E1c[_ZZ2scIiEvRT_E1c] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0x98): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::c' defined in .bss._ZZ2scIiEvRT_E1c[_ZZ2scIiEvRT_E1c] section in /tmp/cc4SlfwT.o
a.cc:(.text._Z2scIiEvRT_[_Z2scIiEvRT_]+0xb7): relocation truncated to fit: R_X86_64_PC32 against symbol `sc<int>(int&)::p' defined in .bss._ZZ2scIiEvRT_E1p[_ZZ2scIiEvRT_E1p] section in /tmp/cc4SlfwT.o
collect2: error: ld returned 1 exit status