#include #include #include #define LL long long #define Re register LL const int N=1e5+5; LL p,n,m,P,w,h,t,H[N],T[N],Q[N],S[N],dp[105][N]; inline LL min(Re a,Re b){return a=0x3f3f3f3f3f3f3f3fll)continue; while(h=slope(Q[t-1],i))--t; Q[++t]=i; } } printf("%lld",dp[P][m]); }