提交时间:2022-07-20 12:03:41

运行 ID: 52854

#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=1e3+10; const int inf=1e9+7; double n,a,b,s[maxn],ans; inline int read() { int s=0,w=1; char ch=getchar(); while(ch<'0'||ch>'9') { if(ch=='-')w=-1; ch=getchar(); } while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar(); return s*w; } inline ll cnt(int x) { ll tot=1; for(int i=1; i<=x; ++i) tot*=i; return tot; } inline bool check() { bool pd=1; for(int i=1; i<=n; ++i) if(s[i]==i) continue; else pd=0; if(!pd) return false; return true; } signed main() { // freopen(".in","r",stdin); // freopen(".out","w",stdout); n=read(),a=read(),b=read(); for(int i=1; i<=n; ++i) s[i]=read(); if(check()) puts("0.000000000000000000000000000000000"); else printf("%.20lf",min(b*cnt(n),a*(n-1))); // cout<<cnt(n)<<endl; return 0; }